Class: Generated::IncludeRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/ruby_grammar_builder/generated/rule.rb

Overview

Represents a rule in the form of { include = ‘#rule_name’; }

Instance Attribute Summary collapse

Attributes inherited from Rule

#location

Instance Method Summary collapse

Constructor Details

#initialize(location, rule) ⇒ IncludeRule

Returns a new instance of IncludeRule.



20
21
22
23
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 20

def initialize(location, rule)
    super(location)
    @rule = rule
end

Instance Attribute Details

#ruleString

Returns The included Rule name.

Returns:

  • (String)

    The included Rule name



18
19
20
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 18

def rule
  @rule
end

Instance Method Details

#to_hObject



25
26
27
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 25

def to_h
    {"include" => @rule}
end