Class: Lrama::Lexer::GrammarFile
- Inherits:
-
Object
- Object
- Lrama::Lexer::GrammarFile
- Defined in:
- lib/lrama/lexer/grammar_file.rb
Defined Under Namespace
Classes: Text
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
: String.
-
#text ⇒ Object
readonly
: String.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(path, text) ⇒ GrammarFile
constructor
A new instance of GrammarFile.
- #inspect ⇒ Object
- #lines ⇒ Object
Constructor Details
#initialize(path, text) ⇒ GrammarFile
Returns a new instance of GrammarFile.
18 19 20 21 |
# File 'lib/lrama/lexer/grammar_file.rb', line 18 def initialize(path, text) @path = path @text = Text.new(text).freeze end |
Instance Attribute Details
#path ⇒ Object (readonly)
: String
14 15 16 |
# File 'lib/lrama/lexer/grammar_file.rb', line 14 def path @path end |
#text ⇒ Object (readonly)
: String
15 16 17 |
# File 'lib/lrama/lexer/grammar_file.rb', line 15 def text @text end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 32 |
# File 'lib/lrama/lexer/grammar_file.rb', line 29 def ==(other) self.class == other.class && self.path == other.path end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/lrama/lexer/grammar_file.rb', line 24 def inspect "<#{self.class}: @path=#{path}, @text=#{text.inspect}>" end |
#lines ⇒ Object
35 36 37 |
# File 'lib/lrama/lexer/grammar_file.rb', line 35 def lines @lines ||= text.split("\n") end |