File: action_controller.rb

package info (click to toggle)
ruby-rbpdf 1.21.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,488 kB
  • sloc: ruby: 138,259; makefile: 12
file content (40 lines) | stat: -rw-r--r-- 856 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Rbpdf
  module ActionController

    DEFAULT_RBPDF_OPTIONS = {:inline=>true}
      
      def self.included(base)
        base.extend ClassMethods
      end

      module ClassMethods
        def rbpdf(options)
          rbpdf_options = breakdown_rbpdf_options options
          write_inheritable_hash(:rbpdf, rbpdf_options)
        end

      private

        def breakdown_rbpdf_options(options)
          rbpdf_options = options.dup
          rbpdf_options
        end
      end

      def rbpdf(options)
        @rbpdf_options ||= DEFAULT_RBPDF_OPTIONS.dup
        @rbpdf_options.merge! options
      end


    private

      def compute_rbpdf_options
        @rbpdf_options ||= DEFAULT_RBPDF_OPTIONS.dup
        @rbpdf_options.merge!(self.class.read_inheritable_attribute(:rbpdf) || {}) {|k,o,n| o}
        @rbpdf_options
      end
  end
end