class ABNF::Parser::Node::PatternMatch

Attributes

abnf[R]
match_data[R]

Public Class Methods

new(match_data, abnf) click to toggle source
# File lib/abnf/parser/node.rb, line 117
def initialize match_data, abnf
  @match_data = match_data
  @abnf = abnf
end

Public Instance Methods

pattern() click to toggle source
# File lib/abnf/parser/node.rb, line 122
def pattern
  match_data.regexp
end
text() click to toggle source
# File lib/abnf/parser/node.rb, line 126
def text
  match_data.to_s
end
to_h() click to toggle source
# File lib/abnf/parser/node.rb, line 130
def to_h
  hash = {}

  match_data.names.each do |name|
    hash[name] = match_data[name]
  end

  hash
end