Class: SimpleAttributeMapper::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_attribute_mapper/map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#mappingsObject

Returns the value of attribute mappings.



10
11
12
# File 'lib/simple_attribute_mapper/map.rb', line 10

def mappings
  @mappings
end

#source_classObject

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_classObject

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