Class: Benedictus::Plan::Tree
- Inherits:
-
Object
- Object
- Benedictus::Plan::Tree
- Defined in:
- lib/benedictus/plan/tree.rb
Instance Attribute Summary collapse
-
#execution_time ⇒ Object
readonly
Returns the value of attribute execution_time.
-
#planning_time ⇒ Object
readonly
Returns the value of attribute planning_time.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#triggers ⇒ Object
readonly
Returns the value of attribute triggers.
Instance Method Summary collapse
- #analyzed? ⇒ Boolean
- #each_node(&block) ⇒ Object
-
#initialize(root, planning_time: nil, execution_time: nil, triggers: [], raw: nil) ⇒ Tree
constructor
A new instance of Tree.
- #total_cost ⇒ Object
- #total_rows ⇒ Object
- #total_time ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize(root, planning_time: nil, execution_time: nil, triggers: [], raw: nil) ⇒ Tree
Returns a new instance of Tree.
8 9 10 11 12 13 14 |
# File 'lib/benedictus/plan/tree.rb', line 8 def initialize(root, planning_time: nil, execution_time: nil, triggers: [], raw: nil) @root = root @planning_time = planning_time @execution_time = execution_time @triggers = triggers @raw = raw end |
Instance Attribute Details
#execution_time ⇒ Object (readonly)
Returns the value of attribute execution_time.
6 7 8 |
# File 'lib/benedictus/plan/tree.rb', line 6 def execution_time @execution_time end |
#planning_time ⇒ Object (readonly)
Returns the value of attribute planning_time.
6 7 8 |
# File 'lib/benedictus/plan/tree.rb', line 6 def planning_time @planning_time end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/benedictus/plan/tree.rb', line 6 def raw @raw end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/benedictus/plan/tree.rb', line 6 def root @root end |
#triggers ⇒ Object (readonly)
Returns the value of attribute triggers.
6 7 8 |
# File 'lib/benedictus/plan/tree.rb', line 6 def triggers @triggers end |
Instance Method Details
#analyzed? ⇒ Boolean
32 33 34 |
# File 'lib/benedictus/plan/tree.rb', line 32 def analyzed? root.analyzed? end |
#each_node(&block) ⇒ Object
16 17 18 19 20 |
# File 'lib/benedictus/plan/tree.rb', line 16 def each_node(&block) return enum_for(:each_node) unless block traverse(root, &block) end |
#total_cost ⇒ Object
22 23 24 |
# File 'lib/benedictus/plan/tree.rb', line 22 def total_cost root.total_cost end |
#total_rows ⇒ Object
36 37 38 |
# File 'lib/benedictus/plan/tree.rb', line 36 def total_rows root.actual_rows || root.plan_rows end |
#total_time ⇒ Object
26 27 28 29 30 |
# File 'lib/benedictus/plan/tree.rb', line 26 def total_time return execution_time if execution_time root.actual_total_time end |
#warnings ⇒ Object
40 41 42 |
# File 'lib/benedictus/plan/tree.rb', line 40 def warnings each_node.flat_map(&:warnings) end |