Class: ChronicTree::Command::AddChildElementsToReplacedObject

Inherits:
Object
  • Object
show all
Defined in:
lib/chronic_tree/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, source_root_id, target, child_elements) ⇒ AddChildElementsToReplacedObject

Returns a new instance of AddChildElementsToReplacedObject.



126
127
128
129
130
131
# File 'lib/chronic_tree/command.rb', line 126

def initialize(source, source_root_id, target, child_elements)
  @source = source
  @source_root_id = source_root_id
  @target = target
  @child_elements = child_elements
end

Instance Attribute Details

#child_elementsObject (readonly)

Returns the value of attribute child_elements.



124
125
126
# File 'lib/chronic_tree/command.rb', line 124

def child_elements
  @child_elements
end

#sourceObject (readonly)

Returns the value of attribute source.



124
125
126
# File 'lib/chronic_tree/command.rb', line 124

def source
  @source
end

#source_root_idObject (readonly)

Returns the value of attribute source_root_id.



124
125
126
# File 'lib/chronic_tree/command.rb', line 124

def source_root_id
  @source_root_id
end

#targetObject (readonly)

Returns the value of attribute target.



124
125
126
# File 'lib/chronic_tree/command.rb', line 124

def target
  @target
end

Instance Method Details

#doObject



133
134
135
# File 'lib/chronic_tree/command.rb', line 133

def do
  child_elements.each { |el| AddChildElement.new(target, el.child_id, el.distance).do }
end