Class: Lotus::Model::Mapping::Attribute Private
- Inherits:
-
Object
- Object
- Lotus::Model::Mapping::Attribute
- Defined in:
- lib/lotus/model/mapping/attribute.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Mapping attribute
Constant Summary collapse
- COERCERS_NAMESPACE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"Lotus::Model::Mapping::Coercers".freeze
Instance Method Summary collapse
- #==(other) ⇒ Object private
- #dump_coercer ⇒ Object private
-
#initialize(name, coercer, options) ⇒ Lotus::Model::Mapping::Attribute
constructor
private
Initialize a new attribute.
- #load_coercer ⇒ Object private
-
#mapped ⇒ Symbol
private
Returns the mapped name.
Constructor Details
#initialize(name, coercer, options) ⇒ Lotus::Model::Mapping::Attribute
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new attribute
32 33 34 35 36 |
# File 'lib/lotus/model/mapping/attribute.rb', line 32 def initialize(name, coercer, ) @name = name.to_sym @coercer = coercer @options = end |
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 |
# File 'lib/lotus/model/mapping/attribute.rb', line 64 def ==(other) self.class == other.class && self.name == other.name && self.mapped == other.mapped && self.coercer == other.coercer end |
#dump_coercer ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 |
# File 'lib/lotus/model/mapping/attribute.rb', line 58 def dump_coercer "#{ coercer }.dump" end |
#load_coercer ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 |
# File 'lib/lotus/model/mapping/attribute.rb', line 52 def load_coercer "#{ coercer }.load" end |
#mapped ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the mapped name
46 47 48 |
# File 'lib/lotus/model/mapping/attribute.rb', line 46 def mapped (@options.fetch(:as) { name }).to_sym end |