Class: SimpleAttributeMapper::Map
- Inherits:
-
Object
- Object
- SimpleAttributeMapper::Map
- Defined in:
- lib/simple_attribute_mapper/map.rb
Instance Attribute Summary collapse
-
#mappings ⇒ Object
Returns the value of attribute mappings.
-
#source_class ⇒ Object
Returns the value of attribute source_class.
-
#target_class ⇒ Object
Returns the value of attribute target_class.
Instance Method Summary collapse
-
#initialize(source_class) ⇒ Map
constructor
A new instance of Map.
- #to(target_class) ⇒ Object
- #with(args) ⇒ Object
Constructor Details
#initialize(source_class) ⇒ Map
Returns a new instance of Map.
3 4 5 6 |
# File 'lib/simple_attribute_mapper/map.rb', line 3 def initialize(source_class) @source_class = source_class @mappings = {} end |
Instance Attribute Details
#mappings ⇒ Object
Returns the value of attribute mappings.
10 11 12 |
# File 'lib/simple_attribute_mapper/map.rb', line 10 def mappings @mappings end |
#source_class ⇒ Object
Returns the value of attribute source_class.
9 10 11 |
# File 'lib/simple_attribute_mapper/map.rb', line 9 def source_class @source_class end |
#target_class ⇒ Object
Returns the value of attribute target_class.
8 9 10 |
# File 'lib/simple_attribute_mapper/map.rb', line 8 def target_class @target_class end |
Instance Method Details
#to(target_class) ⇒ Object
12 13 14 15 |
# File 'lib/simple_attribute_mapper/map.rb', line 12 def to(target_class) @target_class = target_class self end |
#with(args) ⇒ Object
17 18 19 20 |
# File 'lib/simple_attribute_mapper/map.rb', line 17 def with(args) mappings.merge!(args) self end |