Class: ABNF::Compiler::AST::Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/abnf/compiler/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*nodes) ⇒ Sequence

Returns a new instance of Sequence.



52
53
54
# File 'lib/abnf/compiler/ast.rb', line 52

def initialize *nodes
  @nodes = nodes
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



50
51
52
# File 'lib/abnf/compiler/ast.rb', line 50

def nodes
  @nodes
end

Instance Method Details

#==(other_node) ⇒ Object



56
57
58
# File 'lib/abnf/compiler/ast.rb', line 56

def == other_node
  other_node.respond_to? :nodes and nodes == other_node.nodes
end

#inner_textObject



60
61
62
63
# File 'lib/abnf/compiler/ast.rb', line 60

def inner_text
  strings = nodes.map &:inner_text
  strings.join
end