Class: SM::FieldsMap

Inherits:
Object
  • Object
show all
Defined in:
lib/entities/fields_map.rb

Overview

map @from to @to aditionally applying a block @block to @to e.g.

for the following fields

{:profile_name    => :name, :block => BLOCK},      # => applies the BLOCK on the :name field and put it in profile_name
{:profile_email   => :email, :block => BLOCK},
{:profile_website => :website}                 # => put the :profile_website data on the corresponding :website field

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, block = nil) ⇒ FieldsMap

Returns a new instance of FieldsMap.



12
13
14
15
16
# File 'lib/entities/fields_map.rb', line 12

def initialize(from, to, block = nil)
  @from = from
  @to   = to
  @block= block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



11
12
13
# File 'lib/entities/fields_map.rb', line 11

def block
  @block
end

#fromObject

Returns the value of attribute from.



11
12
13
# File 'lib/entities/fields_map.rb', line 11

def from
  @from
end

#toObject

Returns the value of attribute to.



11
12
13
# File 'lib/entities/fields_map.rb', line 11

def to
  @to
end