Class: Generated::PatternRule
- Defined in:
- lib/ruby_grammar_builder/generated/rule.rb
Overview
Represents a rule in the form of { patterns = (Ruleā¦); }
Instance Attribute Summary collapse
-
#rules ⇒ Array<Rule>
The list of rules.
Attributes inherited from Rule
Instance Method Summary collapse
-
#initialize(location, rules) ⇒ PatternRule
constructor
A new instance of PatternRule.
- #to_h ⇒ Object
Constructor Details
#initialize(location, rules) ⇒ PatternRule
Returns a new instance of PatternRule.
54 55 56 57 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 54 def initialize(location, rules) super(location) @rules = rules end |
Instance Attribute Details
#rules ⇒ Array<Rule>
Returns The list of rules.
52 53 54 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 52 def rules @rules end |
Instance Method Details
#to_h ⇒ Object
59 60 61 |
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 59 def to_h {"patterns" => @rules.map(&:to_h)} end |