Class: PDFRavager::Template
- Inherits:
-
Object
- Object
- PDFRavager::Template
- Defined in:
- lib/pdf_ravager/template.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #check(name, opts = {}) ⇒ Object
- #checkbox_group(group_name, &blk) ⇒ Object
- #fill(group_name, name) ⇒ Object
-
#initialize(name = nil) {|_self| ... } ⇒ Template
constructor
A new instance of Template.
- #radio_group(group_name, &blk) ⇒ Object
- #ravage(file, opts = {}) ⇒ Object
- #rich_text(name, value) ⇒ Object
- #text(name, value) ⇒ Object
- #uncheck(name, opts = {}) ⇒ Object
Constructor Details
#initialize(name = nil) {|_self| ... } ⇒ Template
Returns a new instance of Template.
13 14 15 16 |
# File 'lib/pdf_ravager/template.rb', line 13 def initialize(name=nil) @name, @fields = name, [] yield self if block_given? end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
11 12 13 |
# File 'lib/pdf_ravager/template.rb', line 11 def fields @fields end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/pdf_ravager/template.rb', line 11 def name @name end |
Instance Method Details
#==(other) ⇒ Object
56 57 58 |
# File 'lib/pdf_ravager/template.rb', line 56 def ==(other) self.fields == other.fields end |
#check(name, opts = {}) ⇒ Object
26 27 28 |
# File 'lib/pdf_ravager/template.rb', line 26 def check(name, opts={}) @fields << PDFRavager::Fields::Checkbox.new(name, true, opts) end |
#checkbox_group(group_name, &blk) ⇒ Object
38 39 40 |
# File 'lib/pdf_ravager/template.rb', line 38 def checkbox_group(group_name, &blk) PDFRavager::Fieldsets::CheckboxGroup.new(self, group_name, &blk) end |
#fill(group_name, name) ⇒ Object
34 35 36 |
# File 'lib/pdf_ravager/template.rb', line 34 def fill(group_name, name) @fields << PDFRavager::Fields::Radio.new(group_name, name) end |
#radio_group(group_name, &blk) ⇒ Object
42 43 44 |
# File 'lib/pdf_ravager/template.rb', line 42 def radio_group(group_name, &blk) PDFRavager::Fieldsets::RadioGroup.new(self, group_name, &blk) end |
#ravage(file, opts = {}) ⇒ Object
47 48 49 |
# File 'lib/pdf_ravager/template.rb', line 47 def ravage(file, opts={}) PDFRavager::Ravager.ravage(self, opts.merge({:in_file => file})) end |
#rich_text(name, value) ⇒ Object
22 23 24 |
# File 'lib/pdf_ravager/template.rb', line 22 def rich_text(name, value) @fields << PDFRavager::Fields::RichText.new(name, value) end |
#text(name, value) ⇒ Object
18 19 20 |
# File 'lib/pdf_ravager/template.rb', line 18 def text(name, value) @fields << PDFRavager::Fields::Text.new(name, value) end |
#uncheck(name, opts = {}) ⇒ Object
30 31 32 |
# File 'lib/pdf_ravager/template.rb', line 30 def uncheck(name, opts={}) @fields << PDFRavager::Fields::Checkbox.new(name, false, opts) end |