Class: Super::Filter::FormObject::AttributeForm
- Inherits:
-
Object
- Object
- Super::Filter::FormObject::AttributeForm
- Defined in:
- lib/super/filter/form_object.rb
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#operators ⇒ Object
readonly
Returns the value of attribute operators.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #each_operator ⇒ Object
- #humanized_attribute_name ⇒ Object
-
#initialize(model:, field_name:, operators:, params:) ⇒ AttributeForm
constructor
A new instance of AttributeForm.
Constructor Details
#initialize(model:, field_name:, operators:, params:) ⇒ AttributeForm
Returns a new instance of AttributeForm.
7 8 9 10 11 12 |
# File 'lib/super/filter/form_object.rb', line 7 def initialize(model:, field_name:, operators:, params:) @model = model @field_name = field_name @operators = operators @params = params || {} end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
15 16 17 |
# File 'lib/super/filter/form_object.rb', line 15 def field_name @field_name end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
14 15 16 |
# File 'lib/super/filter/form_object.rb', line 14 def model @model end |
#operators ⇒ Object (readonly)
Returns the value of attribute operators.
16 17 18 |
# File 'lib/super/filter/form_object.rb', line 16 def operators @operators end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
17 18 19 |
# File 'lib/super/filter/form_object.rb', line 17 def params @params end |
Instance Method Details
#each_operator ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/super/filter/form_object.rb', line 19 def each_operator return enum_for(:each_operator) if !block_given? @operators.each do |operator| operator_form = OperatorForm.new( operator: operator, params: @params[operator.identifier] ) yield(operator_form) end end |
#humanized_attribute_name ⇒ Object
32 33 34 |
# File 'lib/super/filter/form_object.rb', line 32 def humanized_attribute_name @model.human_attribute_name(@field_name) end |