Class: NoCms::Blocks::SimpleFieldSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- NoCms::Blocks::SimpleFieldSerializer
- Defined in:
- app/serializers/no_cms/blocks/simple_field_serializer.rb
Overview
This class implements the default read/write behaviour for simple fields (integers, strings…).
It acts as a default serializer and just read and writes from the fields_info from the container.
Instance Attribute Summary
Attributes inherited from BaseSerializer
#container, #field, #field_config
Instance Method Summary collapse
-
#read_field ⇒ Object
It reads the value from the fields_info hash.
-
#write_field(value) ⇒ Object
It stores the value in the fields_info hash.
Methods inherited from BaseSerializer
#duplicate, #initialize, #read, #write
Constructor Details
This class inherits a constructor from NoCms::Blocks::BaseSerializer
Instance Method Details
#read_field ⇒ Object
It reads the value from the fields_info hash
12 13 14 |
# File 'app/serializers/no_cms/blocks/simple_field_serializer.rb', line 12 def read_field self.container.fields_info.symbolize_keys[self.field] end |
#write_field(value) ⇒ Object
It stores the value in the fields_info hash
18 19 20 |
# File 'app/serializers/no_cms/blocks/simple_field_serializer.rb', line 18 def write_field value self.container.fields_info[self.field] = value end |