Class: Colonization::ModelRelation

Inherits:
ModelEntity show all
Defined in:
lib/colonization/model_relation.rb

Constant Summary collapse

DEAFULT_SEED_INDEX =
3

Instance Method Summary collapse

Constructor Details

#initialize(reflection, strategy) ⇒ ModelRelation



9
10
11
12
# File 'lib/colonization/model_relation.rb', line 9

def initialize(reflection, strategy)
  @reflection = reflection
  @strategy = strategy
end

Instance Method Details

#nameObject



22
23
24
# File 'lib/colonization/model_relation.rb', line 22

def name
  reflection.name
end

#reflectionObject



14
15
16
# File 'lib/colonization/model_relation.rb', line 14

def reflection
  @reflection
end

#strategyObject



18
19
20
# File 'lib/colonization/model_relation.rb', line 18

def strategy
  @strategy || {}
end

#valueObject



26
27
28
29
30
31
32
# File 'lib/colonization/model_relation.rb', line 26

def value
  if strategy[:type] == :fixed
    generate_relation_value_with_fixed_strategy
  else
    generate_relation_value_with_default_strategy
  end
end