Class: ChronicTree::Command::AddChildElementToOrigAncestors
- Inherits:
-
Object
- Object
- ChronicTree::Command::AddChildElementToOrigAncestors
- Defined in:
- lib/chronic_tree/command.rb
Instance Attribute Summary collapse
-
#child ⇒ Object
readonly
Returns the value of attribute child.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #do ⇒ Object
-
#initialize(source, child) ⇒ AddChildElementToOrigAncestors
constructor
A new instance of AddChildElementToOrigAncestors.
Constructor Details
#initialize(source, child) ⇒ AddChildElementToOrigAncestors
Returns a new instance of AddChildElementToOrigAncestors.
94 95 96 97 |
# File 'lib/chronic_tree/command.rb', line 94 def initialize(source, child) @source = source @child = child end |
Instance Attribute Details
#child ⇒ Object (readonly)
Returns the value of attribute child.
92 93 94 |
# File 'lib/chronic_tree/command.rb', line 92 def child @child end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
92 93 94 |
# File 'lib/chronic_tree/command.rb', line 92 def source @source end |
Instance Method Details
#do ⇒ Object
99 100 101 102 103 |
# File 'lib/chronic_tree/command.rb', line 99 def do source.ancestors.each_with_index do |parent_object, index| AddChildElement.new(parent_object, child, index + 2, source.root.id).do end end |