Class: ActiveElement::Components::Util::FieldMapping
- Inherits:
-
Object
- Object
- ActiveElement::Components::Util::FieldMapping
- Includes:
- Translations
- Defined in:
- lib/active_element/components/util/field_mapping.rb
Overview
Utility class for converting field names to labels, CSS classes, and data mappers.
Instance Method Summary collapse
-
#initialize(component, fields, class_name) ⇒ FieldMapping
constructor
A new instance of FieldMapping.
- #mapped_fields ⇒ Object
Methods included from Translations
Constructor Details
#initialize(component, fields, class_name) ⇒ FieldMapping
Returns a new instance of FieldMapping.
10 11 12 13 14 |
# File 'lib/active_element/components/util/field_mapping.rb', line 10 def initialize(component, fields, class_name) @component = component @class_name = class_name @fields = fields end |
Instance Method Details
#mapped_fields ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_element/components/util/field_mapping.rb', line 16 def mapped_fields fields.map do |field| [ field, class_mapper(field), field_to_label(field), decorated_value_mapper(field), (field) ] end end |