Class: AwesomeExplain::PlanNode
- Inherits:
-
Object
- Object
- AwesomeExplain::PlanNode
- Defined in:
- app/models/awesome_explain/plan_node.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#documents_examined ⇒ Object
Returns the value of attribute documents_examined.
-
#documents_returned ⇒ Object
Returns the value of attribute documents_returned.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#id ⇒ Object
Returns the value of attribute id.
-
#index_name ⇒ Object
Returns the value of attribute index_name.
-
#keys_examined ⇒ Object
Returns the value of attribute keys_examined.
-
#label ⇒ Object
Returns the value of attribute label.
-
#n_returned ⇒ Object
Returns the value of attribute n_returned.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#treeviz ⇒ Object
Returns the value of attribute treeviz.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def children @children end |
#documents_examined ⇒ Object
Returns the value of attribute documents_examined.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def documents_examined @documents_examined end |
#documents_returned ⇒ Object
Returns the value of attribute documents_returned.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def documents_returned @documents_returned end |
#duration ⇒ Object
Returns the value of attribute duration.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def duration @duration end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def id @id end |
#index_name ⇒ Object
Returns the value of attribute index_name.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def index_name @index_name end |
#keys_examined ⇒ Object
Returns the value of attribute keys_examined.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def keys_examined @keys_examined end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def label @label end |
#n_returned ⇒ Object
Returns the value of attribute n_returned.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def n_returned @n_returned end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def parent @parent end |
#treeviz ⇒ Object
Returns the value of attribute treeviz.
3 4 5 |
# File 'app/models/awesome_explain/plan_node.rb', line 3 def treeviz @treeviz end |
Class Method Details
.build(data, parent = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/awesome_explain/plan_node.rb', line 15 def self.build(data, parent = nil) instance = PlanNode.new instance.label = data.dig(:stage) instance.documents_returned = data.dig(:docsReturned) instance.n_returned = data.dig(:nReturned) instance.documents_examined = data.dig(:docsExamined) instance.keys_examined = data.dig(:keysExamined) instance.duration = data.dig(:executionTimeMillisEstimate) instance.index_name = data.dig(:indexName) instance.parent = parent instance.children = [] instance end |
Instance Method Details
#collscan? ⇒ Boolean
29 30 31 |
# File 'app/models/awesome_explain/plan_node.rb', line 29 def collscan? label.downcase == 'collscan' end |
#meta_data ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/awesome_explain/plan_node.rb', line 41 def data = [] data << "<strong>Docs Returned:</strong> #{documents_returned}" if documents_returned.present? data << "<strong>N Returned:</strong> #{n_returned}" if n_returned.present? data << "<strong>Docs Examined:</strong> #{documents_examined}" if documents_examined.present? data << "<strong>Keys Examined</strong> #{keys_examined}" if keys_examined.present? data << "<strong>Duration</strong> #{duration}" if duration.present? data << "<strong>Index</strong> #{index_name}" if index_name.present? data end |
#meta_data_str ⇒ Object
37 38 39 |
# File 'app/models/awesome_explain/plan_node.rb', line 37 def .join('<hr />') end |