Module: JsonFields::Configurable
- Defined in:
- lib/json_fields/configurable.rb
Constant Summary collapse
- @@fields =
{}
Instance Method Summary collapse
Instance Method Details
#json_field(attribute, json_structure) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/json_fields/configurable.rb', line 5 def json_field(attribute, json_structure) @@fields[attribute] = JsonFields::ConfigurationParser.parse!(json_structure) define_method("#{attribute}=") do |values| value = self.class.json_fields[attribute].assemble(values) self.write_attribute(attribute, value) end end |
#json_fields ⇒ Object
13 14 15 |
# File 'lib/json_fields/configurable.rb', line 13 def json_fields @@fields end |