Class: NumberMuncher::Tokenizer
- Inherits:
-
Object
- Object
- NumberMuncher::Tokenizer
- Includes:
- Enumerable
- Defined in:
- lib/number_muncher/tokenizer.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
- #call(raise: false) ⇒ Object
-
#initialize(string) ⇒ Tokenizer
constructor
A new instance of Tokenizer.
Constructor Details
#initialize(string) ⇒ Tokenizer
Returns a new instance of Tokenizer.
11 12 13 |
# File 'lib/number_muncher/tokenizer.rb', line 11 def initialize(string) @string = string end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
9 10 11 |
# File 'lib/number_muncher/tokenizer.rb', line 9 def string @string end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
9 10 11 |
# File 'lib/number_muncher/tokenizer.rb', line 9 def tokens @tokens end |
Instance Method Details
#call(raise: false) ⇒ Object
15 16 17 18 19 |
# File 'lib/number_muncher/tokenizer.rb', line 15 def call(raise: false) @tokens = [] scan(raise) until scanner.eos? tokens end |