class PrawnRailsForms::FieldRow
Attributes
document[RW]
height[RW]
unit_width[RW]
units[RW]
x[RW]
y[RW]
Public Class Methods
new(document, height, units, x, y, unit_width)
click to toggle source
# File lib/prawn-rails-forms/field_row.rb, line 7 def initialize(document, height, units, x, y, unit_width) @document, @height, @units, @x, @y, @unit_width = document, height, units, x, y, unit_width end
Public Instance Methods
at_height(height, options = {}) { || ... }
click to toggle source
# File lib/prawn-rails-forms/field_row.rb, line 12 def at_height(height, options = {}) @y -= height @x = options[:unit] * @unit_width if options[:unit].present? yield @y += height end
check_box_field(**args)
click to toggle source
# File lib/prawn-rails-forms/field_row.rb, line 26 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)
click to toggle source
# File lib/prawn-rails-forms/field_row.rb, line 19 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
Private Instance Methods
field_attributes(args)
click to toggle source
# File lib/prawn-rails-forms/field_row.rb, line 35 def field_attributes(args) start = [@x, @y] width = @unit_width * (args[:width] || 1) height = args[:height] || @height [start, width, height] end