Class: Dhaka::TokenizerSuccessResult

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/tokenizer/tokenizer.rb

Overview

Returned on successful tokenizing of the input stream. Supports iteration by including Enumerable, so it can be passed in directly to the parser.

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ TokenizerSuccessResult

Returns a new instance of TokenizerSuccessResult.



10
11
12
# File 'lib/tokenizer/tokenizer.rb', line 10

def initialize(tokens)
  @tokens = tokens
end

Instance Method Details

#eachObject



17
18
19
20
21
# File 'lib/tokenizer/tokenizer.rb', line 17

def each
  @tokens.each do |token|
    yield token
  end
end

#has_error?Boolean

Returns false.

Returns:

  • (Boolean)


14
15
16
# File 'lib/tokenizer/tokenizer.rb', line 14

def has_error?
  false
end