Class: BELParser::Script::FirstNode
- Inherits:
-
Object
- Object
- BELParser::Script::FirstNode
- Defined in:
- lib/bel_parser/script/first_node.rb
Overview
FirstNode will return the first node from the set of AST nodes provided.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(ast_enum) ⇒ FirstNode
constructor
A new instance of FirstNode.
Constructor Details
#initialize(ast_enum) ⇒ FirstNode
Returns a new instance of FirstNode.
6 7 8 |
# File 'lib/bel_parser/script/first_node.rb', line 6 def initialize(ast_enum) @ast_enum = ast_enum end |
Instance Method Details
#each ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/bel_parser/script/first_node.rb', line 10 def each if block_given? @ast_enum.each do |(line_number, line, ast_nodes)| yield [line_number, line, ast_nodes.first] end else enum_for(:each) end end |