Class: TokenString
Overview
Class for storing text tokens data - index and text
Instance Attribute Summary collapse
-
#idx ⇒ Object
readonly
Returns the value of attribute idx.
Instance Method Summary collapse
- #<<(pending_text) ⇒ Object
-
#initialize(lexer, text = '') ⇒ TokenString
constructor
A new instance of TokenString.
Methods inherited from String
Constructor Details
#initialize(lexer, text = '') ⇒ TokenString
Returns a new instance of TokenString.
13 14 15 16 17 |
# File 'lib/mediacloth/mediawikilexer.rb', line 13 def initialize(lexer, text = '') @lexer = lexer @idx = 0 super(text) end |
Instance Attribute Details
#idx ⇒ Object (readonly)
Returns the value of attribute idx.
11 12 13 |
# File 'lib/mediacloth/mediawikilexer.rb', line 11 def idx @idx end |
Instance Method Details
#<<(pending_text) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/mediacloth/mediawikilexer.rb', line 19 def <<(pending_text) # If TokenString.length is 0 and we are pushing some text # than in this moment we can retreive this tokes's index if length == 0 @idx = @lexer.cursor end super(pending_text) end |