Class: ABNF::Compiler::AST::Repetition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*nodes) ⇒ Repetition

Returns a new instance of Repetition.



31
32
33
# File 'lib/abnf/compiler/ast.rb', line 31

def initialize *nodes
  @nodes = nodes
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



29
30
31
# File 'lib/abnf/compiler/ast.rb', line 29

def nodes
  @nodes
end

Instance Method Details

#==(other_node) ⇒ Object



35
36
37
# File 'lib/abnf/compiler/ast.rb', line 35

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

#inner_textObject



39
40
41
42
# File 'lib/abnf/compiler/ast.rb', line 39

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