class BELParser::Script::FirstNode

FirstNode will return the first node from the set of {BELParser::Parsers::AST::Node AST nodes} provided.

Public Class Methods

new(ast_enum) click to toggle source
# File lib/bel_parser/script/first_node.rb, line 6
def initialize(ast_enum)
  @ast_enum = ast_enum
end

Public Instance Methods

each() { |line_number, line, first| ... } click to toggle source
# 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