Class: Para::ModelFieldParsers::Enums
- Defined in:
- lib/para/model_field_parsers/enums.rb
Instance Attribute Summary
Attributes inherited from Base
#fields_hash, #mappings, #model
Instance Method Summary collapse
Methods inherited from Base
#find_attributes_for_mapping, #initialize, register
Constructor Details
This class inherits a constructor from Para::ModelFieldParsers::Base
Instance Method Details
#applicable? ⇒ Boolean
14 15 16 |
# File 'lib/para/model_field_parsers/enums.rb', line 14 def applicable? model.respond_to?(:defined_enums) && !model.defined_enums.empty? end |
#parse! ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/para/model_field_parsers/enums.rb', line 6 def parse! model.defined_enums.each do |key, _| fields_hash[key] = AttributeField::EnumField.new( model, name: key, type: 'enum' ) end end |