Class: JMESPath::TokenStream Private
- Inherits:
-
Object
- Object
- JMESPath::TokenStream
- Defined in:
- lib/jmespath/token_stream.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #expression ⇒ String<JMESPath> readonly private
- #position ⇒ Integer readonly private
- #token ⇒ Token readonly private
Instance Method Summary collapse
-
#initialize(expression, tokens) ⇒ TokenStream
constructor
private
A new instance of TokenStream.
- #inspect ⇒ Object private
- #lookahead(count) ⇒ Object private
- #next(options = {}) ⇒ Object private
Constructor Details
#initialize(expression, tokens) ⇒ TokenStream
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TokenStream.
7 8 9 10 11 12 13 |
# File 'lib/jmespath/token_stream.rb', line 7 def initialize(expression, tokens) @expression = expression @tokens = tokens @token = nil @position = -1 self.next end |
Instance Attribute Details
#expression ⇒ String<JMESPath> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/jmespath/token_stream.rb', line 16 def expression @expression end |
#position ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/jmespath/token_stream.rb', line 22 def position @position end |
#token ⇒ Token (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/jmespath/token_stream.rb', line 19 def token @token end |
Instance Method Details
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 |
# File 'lib/jmespath/token_stream.rb', line 35 def inspect str = [] @tokens.each do |token| str << '%3d %-15s %s' % [token.position, token.type, token.value.inspect] end str.join("\n") end |
#lookahead(count) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/jmespath/token_stream.rb', line 30 def lookahead(count) @tokens[@position + count] || Token::NULL_TOKEN end |
#next(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/jmespath/token_stream.rb', line 26 def next( = {}) validate_match(_next, [:match]) end |