Class: ChronicTree::Command::AddRootElement
- Inherits:
-
Object
- Object
- ChronicTree::Command::AddRootElement
- Defined in:
- lib/chronic_tree/command.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #do ⇒ Object
-
#initialize(source) ⇒ AddRootElement
constructor
A new instance of AddRootElement.
Constructor Details
#initialize(source) ⇒ AddRootElement
Returns a new instance of AddRootElement.
7 8 9 |
# File 'lib/chronic_tree/command.rb', line 7 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/chronic_tree/command.rb', line 5 def source @source end |
Instance Method Details
#do ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/chronic_tree/command.rb', line 11 def do source.send("elements_under_#{source.current_scope_name}_root").create( child: source, parent: source, distance: 0, start_time: source.current_time_at, end_time: 1000.years.since(source.current_time_at) ) end |