Class: PrawnRailsForms::FieldRow
- Inherits:
-
Object
- Object
- PrawnRailsForms::FieldRow
- Defined in:
- lib/prawn-rails-forms.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
-
#height ⇒ Object
Returns the value of attribute height.
-
#unit_width ⇒ Object
Returns the value of attribute unit_width.
-
#units ⇒ Object
Returns the value of attribute units.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #at_height(height, options = {}, &block) ⇒ Object
- #check_box_field(**args) ⇒ Object
-
#initialize(document, height, units, x, y, unit_width) ⇒ FieldRow
constructor
A new instance of FieldRow.
- #text_field(**args) ⇒ Object
Constructor Details
#initialize(document, height, units, x, y, unit_width) ⇒ FieldRow
Returns a new instance of FieldRow.
8 9 10 11 |
# File 'lib/prawn-rails-forms.rb', line 8 def initialize(document,height, units, x, y, unit_width) @document, @height, @units, @x, @y, @unit_width = document, height, units, x, y, unit_width end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
6 7 8 |
# File 'lib/prawn-rails-forms.rb', line 6 def document @document end |
#height ⇒ Object
Returns the value of attribute height.
6 7 8 |
# File 'lib/prawn-rails-forms.rb', line 6 def height @height end |
#unit_width ⇒ Object
Returns the value of attribute unit_width.
6 7 8 |
# File 'lib/prawn-rails-forms.rb', line 6 def unit_width @unit_width end |
#units ⇒ Object
Returns the value of attribute units.
6 7 8 |
# File 'lib/prawn-rails-forms.rb', line 6 def units @units end |
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/prawn-rails-forms.rb', line 6 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
6 7 8 |
# File 'lib/prawn-rails-forms.rb', line 6 def y @y end |
Instance Method Details
#at_height(height, options = {}, &block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/prawn-rails-forms.rb', line 13 def at_height(height, = {}, &block) @y -= height if [:unit].present? @x = [:unit] * @unit_width end block.call @y += height end |
#check_box_field(**args) ⇒ Object
28 29 30 31 32 |
# File 'lib/prawn-rails-forms.rb', line 28 def check_box_field(**args) start, width, height = field_attributes args @document.send :make_check_box_field, start, width, height, **args.except(:width, :height) @x += width end |
#text_field(**args) ⇒ Object
22 23 24 25 26 |
# File 'lib/prawn-rails-forms.rb', line 22 def text_field(**args) start, width, height = field_attributes args @document.send :make_text_field, start, width, height, **args.except(:width, :height) @x += width end |