Class: Prawn::Blank::Form

Inherits:
Hash
  • Object
show all
Defined in:
lib/prawn/blank/form.rb

Instance Method Summary collapse

Constructor Details

#initializeForm

Returns a new instance of Form.



3
4
5
6
7
# File 'lib/prawn/blank/form.rb', line 3

def initialize()
  super()
  self[:DR] = {}
  self[:Fields] = []
end

Instance Method Details

#add_field(field) ⇒ Object



27
28
29
# File 'lib/prawn/blank/form.rb', line 27

def add_field(field)
  self[:Fields] << field
end

#add_resource(type, name, dict) ⇒ Object



9
10
11
12
# File 'lib/prawn/blank/form.rb', line 9

def add_resource(type,name,dict)
  self[:DR][type] ||={}
  self[:DR][type][name] ||= dict
end

#add_resources(hash) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/prawn/blank/form.rb', line 14

def add_resources(hash)
  hash.each do |type, names|
    if names.kind_of? Array
      self[:DR][type] ||= []
      self[:DR][type] = self[:DR][type] | names
    else
      names.each do |name,dict|
        add_resource(type, name, dict)
      end
    end
  end
end