Method: Datamappify::Data::Mapper::Attribute#initialize

Defined in:
lib/datamappify/data/mapper/attribute.rb

#initialize(name, options) ⇒ Attribute



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/datamappify/data/mapper/attribute.rb', line 36

def initialize(name, options)
  @key                  = name
  @name                 = name.to_s
  @options              = options
  @provider_name        = options[:provider].to_s
  @primary_source_class = options[:primary_source_class]

  @source_class_name, @source_attribute_name = parse_source(options[:to])

  if secondary_attribute?
    if reverse_mapped?
      Record.build_reversed_association(self, primary_source_class)
    else
      Record.build_association(self, primary_source_class)
    end
  end
end