Class: ABNF::Parser::Node::PatternMatch
- Inherits:
-
Object
- Object
- ABNF::Parser::Node::PatternMatch
- Includes:
- ABNF::Parser::Node
- Defined in:
- lib/abnf/parser/node.rb
Instance Attribute Summary collapse
-
#abnf ⇒ Object
readonly
Returns the value of attribute abnf.
-
#match_data ⇒ Object
readonly
Returns the value of attribute match_data.
Instance Method Summary collapse
-
#initialize(match_data, abnf) ⇒ PatternMatch
constructor
A new instance of PatternMatch.
- #pattern ⇒ Object
- #text ⇒ Object
- #to_h ⇒ Object
Methods included from ABNF::Parser::Node
#==, alternation, concatenation, #octets, pattern_match, repetition, terminal
Constructor Details
#initialize(match_data, abnf) ⇒ PatternMatch
Returns a new instance of PatternMatch.
113 114 115 116 |
# File 'lib/abnf/parser/node.rb', line 113 def initialize match_data, abnf @match_data = match_data @abnf = abnf end |
Instance Attribute Details
#abnf ⇒ Object (readonly)
Returns the value of attribute abnf.
110 111 112 |
# File 'lib/abnf/parser/node.rb', line 110 def abnf @abnf end |
#match_data ⇒ Object (readonly)
Returns the value of attribute match_data.
111 112 113 |
# File 'lib/abnf/parser/node.rb', line 111 def match_data @match_data end |
Instance Method Details
#pattern ⇒ Object
118 119 120 |
# File 'lib/abnf/parser/node.rb', line 118 def pattern match_data.regexp end |
#text ⇒ Object
122 123 124 |
# File 'lib/abnf/parser/node.rb', line 122 def text match_data.to_s end |
#to_h ⇒ Object
126 127 128 129 130 131 132 133 134 |
# File 'lib/abnf/parser/node.rb', line 126 def to_h hash = {} match_data.names.each do |name| hash[name] = match_data[name] end hash end |