Class: KQL::Query::TopContext

Inherits:
Context
  • Object
show all
Defined in:
lib/kql/query.rb

Instance Attribute Summary collapse

Attributes inherited from Context

#selected_nodes

Instance Method Summary collapse

Methods inherited from Context

#nodes

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

#documentObject

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

Returns:

  • (Boolean)


61
62
63
# File 'lib/kql/query.rb', line 61

def top?
  true
end