Class: ChronicTree::Command::AddReplacedObjToOrigAncestors
- Inherits:
-
Object
- Object
- ChronicTree::Command::AddReplacedObjToOrigAncestors
- Defined in:
- lib/chronic_tree/command.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#source_ancestors ⇒ Object
readonly
Returns the value of attribute source_ancestors.
-
#source_root_id ⇒ Object
readonly
Returns the value of attribute source_root_id.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #do ⇒ Object
-
#initialize(source, source_root_id, source_ancestors, target) ⇒ AddReplacedObjToOrigAncestors
constructor
A new instance of AddReplacedObjToOrigAncestors.
Constructor Details
#initialize(source, source_root_id, source_ancestors, target) ⇒ AddReplacedObjToOrigAncestors
Returns a new instance of AddReplacedObjToOrigAncestors.
109 110 111 112 113 114 |
# File 'lib/chronic_tree/command.rb', line 109 def initialize(source, source_root_id, source_ancestors, target) @source = source @source_root_id = source_root_id @source_ancestors = source_ancestors @target = target end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
107 108 109 |
# File 'lib/chronic_tree/command.rb', line 107 def source @source end |
#source_ancestors ⇒ Object (readonly)
Returns the value of attribute source_ancestors.
107 108 109 |
# File 'lib/chronic_tree/command.rb', line 107 def source_ancestors @source_ancestors end |
#source_root_id ⇒ Object (readonly)
Returns the value of attribute source_root_id.
107 108 109 |
# File 'lib/chronic_tree/command.rb', line 107 def source_root_id @source_root_id end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
107 108 109 |
# File 'lib/chronic_tree/command.rb', line 107 def target @target end |
Instance Method Details
#do ⇒ Object
116 117 118 119 120 |
# File 'lib/chronic_tree/command.rb', line 116 def do source_ancestors.each_with_index do |parent_object, i| AddChildElement.new(parent_object, target.id, i + 1, source_root_id).do end end |