Class: DocoptNG::TokenStream

Inherits:
Array
  • Object
show all
Defined in:
lib/docopt_ng/token_stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, error) ⇒ TokenStream

Returns a new instance of TokenStream.



5
6
7
8
9
10
11
12
13
# File 'lib/docopt_ng/token_stream.rb', line 5

def initialize(source, error)
  if !source
    source = []
  elsif source.class != ::Array
    source = source.split
  end
  super(source)
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



3
4
5
# File 'lib/docopt_ng/token_stream.rb', line 3

def error
  @error
end

Instance Method Details

#currentObject



19
20
21
# File 'lib/docopt_ng/token_stream.rb', line 19

def current
  self[0]
end

#moveObject



15
16
17
# File 'lib/docopt_ng/token_stream.rb', line 15

def move
  shift
end