Method: FlatMap::Mapping#initialize

Defined in:
lib/flat_map/mapping.rb

#initialize(mapper, name, target_attribute, options = {}) ⇒ Mapping

Initialize a mapping, passing to it a mapper, which is a gateway to actual target, name, which is an external identifier, target_attribute, which is used to access actual information of the target, and options.

Parameters:

  • mapper (FlatMap::Mapper)
  • name (Symbol)
  • target_attribute (Symbol)
  • options (Hash) (defaults to: {})
  • [Symbol, (Hash)

    a customizable set of options

  • [Symbol] (Hash)

    a customizable set of options

  • [Class] (Hash)

    a customizable set of options



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/flat_map/mapping.rb', line 37

def initialize(mapper, name, target_attribute, options = {})
  @mapper           = mapper
  @name             = name
  @target_attribute = target_attribute

  @full_name = mapper.suffixed? ? :"#{@name}_#{mapper.suffix}" : name

  @multiparam = options[:multiparam]

  fetch_reader(options)
  fetch_writer(options)
end