Class: Caisson::Helpers::Form::Builder::Base
- Inherits:
-
Object
- Object
- Caisson::Helpers::Form::Builder::Base
- Defined in:
- lib/caisson/helpers/form/builder/base.rb
Instance Attribute Summary collapse
-
#interpreti ⇒ Object
readonly
Returns the value of attribute interpreti.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(core, record) ⇒ Base
constructor
************************************************************************************* CONSTRUCTOR *************************************************************************************.
-
#line(field_name, options = {}) ⇒ Object
************************************************************************************* PUBLIC INSTANCE METHODS *************************************************************************************.
- #line_label(field, options = {}) ⇒ Object
Constructor Details
#initialize(core, record) ⇒ Base
************************************************************************************* CONSTRUCTOR *************************************************************************************
8 9 10 11 12 |
# File 'lib/caisson/helpers/form/builder/base.rb', line 8 def initialize(core, record) @core = core @record = record @interpreti = Caisson::Helpers::Form::Builder::Interpreti.new(@record) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object (private)
70 |
# File 'lib/caisson/helpers/form/builder/base.rb', line 70 def method_missing(*args, &block) return @core.send(*args, &block) end |
Instance Attribute Details
#interpreti ⇒ Object (readonly)
Returns the value of attribute interpreti.
3 4 5 |
# File 'lib/caisson/helpers/form/builder/base.rb', line 3 def interpreti @interpreti end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
3 4 5 |
# File 'lib/caisson/helpers/form/builder/base.rb', line 3 def record @record end |
Instance Method Details
#line(field_name, options = {}) ⇒ Object
************************************************************************************* PUBLIC INSTANCE METHODS *************************************************************************************
18 19 20 21 22 23 24 25 26 |
# File 'lib/caisson/helpers/form/builder/base.rb', line 18 def line(field_name, ={}) .reverse_merge!(choices: nil, hint: true, id: 'undefined', label: 'undefined', nature: nil, placeholder: false, value: 'undefined') field = field_builder(field_name, ()) label_str = line_label(field, force: [:label]) return caisson.line(label_str, field.build, (field, )) end |
#line_label(field, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/caisson/helpers/form/builder/base.rb', line 28 def line_label(field, ={}) .reverse_merge!(force: 'undefined') return case when [:force] != 'undefined' then [:force] when field.checkbox? then nil when field.hidden? then nil else field.label end end |