Class: Miniform::Field
- Inherits:
-
Object
- Object
- Miniform::Field
- Defined in:
- lib/miniform/field.rb
Instance Method Summary collapse
-
#initialize(builder, name, options, &block) ⇒ Field
constructor
A new instance of Field.
- #render ⇒ Object
Constructor Details
#initialize(builder, name, options, &block) ⇒ Field
Returns a new instance of Field.
3 4 5 6 7 8 |
# File 'lib/miniform/field.rb', line 3 def initialize(builder, name, , &block) @builder = builder @name = name @options = @block = block end |
Instance Method Details
#render ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/miniform/field.rb', line 10 def render if should_omit_label? @block.call + help_block else @builder.form_group(@name) do if vertical? label + @block.call + help_block else label + input_wrapper { @block.call + help_block } end end end end |