Class: KQL::Query::TopContext
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
Attributes inherited from Context
Instance Method Summary collapse
- #children(**kwargs) ⇒ Object
-
#initialize(document) ⇒ TopContext
constructor
A new instance of TopContext.
- #top? ⇒ Boolean
Methods inherited from Context
Constructor Details
#initialize(document) ⇒ TopContext
Returns a new instance of TopContext.
52 53 54 55 |
# File 'lib/kql/query.rb', line 52 def initialize(document) @document = document super(children) end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
50 51 52 |
# File 'lib/kql/query.rb', line 50 def document @document end |
Instance Method Details
#children(**kwargs) ⇒ Object
57 58 59 |
# File 'lib/kql/query.rb', line 57 def children(**kwargs) document.nodes.each_with_index.map { |n, i| Query::SelectedNode.new(n, document.nodes, i, **kwargs) } end |
#top? ⇒ Boolean
61 62 63 |
# File 'lib/kql/query.rb', line 61 def top? true end |