Class: Generated::MatchRule
- Defined in:
- lib/ruby_grammar_builder/generated/rule.rb
Instance Attribute Summary collapse
-
#captures ⇒ Hash<String=>Rule>
The capture rules.
-
#match ⇒ String
The match pattern.
-
#name ⇒ String?
The name for this rule.
Attributes inherited from Rule
Instance Method Summary collapse
-
#initialize(location) ⇒ MatchRule
constructor
A new instance of MatchRule.
- #to_h ⇒ Object
Constructor Details
#initialize(location) ⇒ MatchRule
Returns a new instance of MatchRule.
72 73 74 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 72 def initialize(location) super(location) end |
Instance Attribute Details
#captures ⇒ Hash<String=>Rule>
Returns The capture rules.
70 71 72 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 70 def captures @captures end |
#match ⇒ String
Returns The match pattern.
66 67 68 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 66 def match @match end |
#name ⇒ String?
Returns The name for this rule.
68 69 70 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 68 def name @name end |
Instance Method Details
#to_h ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 76 def to_h { "match" => @match, "name" => @name, "captures" => @captures.transform_values(&:to_h), }.compact end |