Class: Generated::NameRule

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

Overview

Represents a rule in the form of { name = ‘string’; }

Instance Attribute Summary collapse

Attributes inherited from Rule

#location

Instance Method Summary collapse

Constructor Details

#initialize(location, name) ⇒ NameRule

Returns a new instance of NameRule.



37
38
39
40
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 37

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

Instance Attribute Details

#nameString

Returns The name of the rule.

Returns:

  • (String)

    The name of the rule



35
36
37
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 35

def name
  @name
end

Instance Method Details

#to_hObject



42
43
44
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 42

def to_h
    {"name" => @name}
end