Class: Dendroid::Syntax::GrmSymbol
- Inherits:
-
Object
- Object
- Dendroid::Syntax::GrmSymbol
- Defined in:
- lib/dendroid/syntax/grm_symbol.rb
Overview
Abstract class for grammar symbols. A grammar symbol is an element that appears in grammar rules.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The name of the grammar symbol.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Equality testing (based on symbol names).
-
#initialize(symbolName) ⇒ GrmSymbol
constructor
Constructor.
-
#to_s ⇒ String
The String representation of the grammar symbol.
Constructor Details
#initialize(symbolName) ⇒ GrmSymbol
Constructor. aSymbolName [String] The name of the grammar symbol.
14 15 16 |
# File 'lib/dendroid/syntax/grm_symbol.rb', line 14 def initialize(symbolName) @name = valid_name(symbolName) end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns The name of the grammar symbol.
10 11 12 |
# File 'lib/dendroid/syntax/grm_symbol.rb', line 10 def name @name end |
Instance Method Details
#==(other) ⇒ Boolean
Equality testing (based on symbol names)
26 27 28 |
# File 'lib/dendroid/syntax/grm_symbol.rb', line 26 def ==(other) name == other.name end |
#to_s ⇒ String
The String representation of the grammar symbol
20 21 22 |
# File 'lib/dendroid/syntax/grm_symbol.rb', line 20 def to_s name.to_s end |