Class: HashMapper::Map
- Inherits:
- 
      Object
      
        - Object
- HashMapper::Map
 
- Defined in:
- lib/hash_mapper.rb
Overview
Contains PathMaps Makes them interact
Instance Attribute Summary collapse
- 
  
    
      #delegated_mapper  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute delegated_mapper. 
- 
  
    
      #path_from  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute path_from. 
- 
  
    
      #path_to  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute path_to. 
Instance Method Summary collapse
- 
  
    
      #initialize(path_from, path_to, delegated_mapper = nil)  ⇒ Map 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Map. 
- #process_into(output, input, meth = :normalize) ⇒ Object
Constructor Details
#initialize(path_from, path_to, delegated_mapper = nil) ⇒ Map
Returns a new instance of Map.
| 111 112 113 | # File 'lib/hash_mapper.rb', line 111 def initialize(path_from, path_to, delegated_mapper = nil) @path_from, @path_to, @delegated_mapper = path_from, path_to, delegated_mapper end | 
Instance Attribute Details
#delegated_mapper ⇒ Object (readonly)
Returns the value of attribute delegated_mapper.
| 109 110 111 | # File 'lib/hash_mapper.rb', line 109 def delegated_mapper @delegated_mapper end | 
#path_from ⇒ Object (readonly)
Returns the value of attribute path_from.
| 109 110 111 | # File 'lib/hash_mapper.rb', line 109 def path_from @path_from end | 
#path_to ⇒ Object (readonly)
Returns the value of attribute path_to.
| 109 110 111 | # File 'lib/hash_mapper.rb', line 109 def path_to @path_to end | 
Instance Method Details
#process_into(output, input, meth = :normalize) ⇒ Object
| 115 116 117 118 119 120 121 | # File 'lib/hash_mapper.rb', line 115 def process_into(output, input, meth = :normalize) path_1, path_2 = (meth == :normalize ? [path_from, path_to] : [path_to, path_from]) catch :no_value do value = get_value_from_input(output, input, path_1, meth) add_value_to_hash!(output, path_2, value) end end |