Class: Hospodar::Builder::Strategies::Translate::ExecutionPlanMatrix

Inherits:
Struct
  • Object
show all
Defined in:
lib/hospodar/builder/strategies/translate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject

Returns the value of attribute collection

Returns:

  • (Object)

    the current value of collection



21
22
23
# File 'lib/hospodar/builder/strategies/translate.rb', line 21

def collection
  @collection
end

Instance Method Details

#to_nested_form(builder_params) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/hospodar/builder/strategies/translate.rb', line 29

def to_nested_form(builder_params)
  data = collection
  data.unshift(builder_params.to_a) unless builder_params.object.nil?
  intermediate_form = data.transpose
  tobe_assembled = intermediate_form[1..-1]
  keys = intermediate_form[0..1].transpose.map { |g, e| ID_CLASS.new(g, e) }
  tobe_assembled.first.pop
  tobe_assembled.first.unshift(nil)
  tobe_assembled << keys
  self.collection = tobe_assembled.transpose
  self
end

#with_creation_procs(factory) ⇒ Object



22
23
24
25
26
27
# File 'lib/hospodar/builder/strategies/translate.rb', line 22

def with_creation_procs(factory)
  self.collection = collection.map do |group, title|
    [group, title, factory.hospodar_assembler_new_instance(group, title)]
  end
  self
end