Class: Yoda::Parsing::Traverser::ResultSet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, QueryInterface
Defined in:
lib/yoda/parsing/traverser/result_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from QueryInterface

#query, #query_all, #query_ancestor, #query_ancestors

Constructor Details

#initialize(nodes) ⇒ ResultSet

Returns a new instance of ResultSet.



16
17
18
# File 'lib/yoda/parsing/traverser/result_set.rb', line 16

def initialize(nodes)
  @nodes = nodes
end

Instance Attribute Details

#nodesEnumerable<AST::Node> (readonly)

Returns:



12
13
14
# File 'lib/yoda/parsing/traverser/result_set.rb', line 12

def nodes
  @nodes
end

Instance Method Details

#all_nodesEnumerable<AST::Node>

Returns:



21
22
23
# File 'lib/yoda/parsing/traverser/result_set.rb', line 21

def all_nodes
  flat_map(&method(:all_nodes_for))
end

#nestingEnumerable<AST::Node>

Returns:



26
27
28
# File 'lib/yoda/parsing/traverser/result_set.rb', line 26

def nesting
  flat_map(&method(:nesting))
end

#to_aArray<AST::Node>

Returns:



31
32
33
# File 'lib/yoda/parsing/traverser/result_set.rb', line 31

def to_a
  nodes.to_a
end