Class: DeltaCore::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/delta_core/mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, key:, strategy:, fields: [], relations: {}) ⇒ Mapping

Returns a new instance of Mapping.



7
8
9
10
11
12
13
# File 'lib/delta_core/mapping.rb', line 7

def initialize(name, key:, strategy:, fields: [], relations: {})
  @name      = name.to_sym
  @key       = key.to_sym
  @fields    = Array(fields).map(&:to_sym)
  @strategy  = strategy.to_sym
  @relations = build_relations(relations || {})
end

Instance Attribute Details

#fields ⇒ Object (readonly)

Returns the value of attribute fields.



5
6
7
# File 'lib/delta_core/mapping.rb', line 5

def fields
  @fields
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/delta_core/mapping.rb', line 5

def key
  @key
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/delta_core/mapping.rb', line 5

def name
  @name
end

#relations ⇒ Object (readonly)

Returns the value of attribute relations.



5
6
7
# File 'lib/delta_core/mapping.rb', line 5

def relations
  @relations
end

#strategy ⇒ Object (readonly)

Returns the value of attribute strategy.



5
6
7
# File 'lib/delta_core/mapping.rb', line 5

def strategy
  @strategy
end