Class: JsonCompleter::Scanners::KeywordToken
- Inherits:
-
Struct
- Object
- Struct
- JsonCompleter::Scanners::KeywordToken
- Defined in:
- lib/json_completer/scanners.rb
Instance Attribute Summary collapse
-
#matched ⇒ Object
Returns the value of attribute matched.
-
#slot ⇒ Object
Returns the value of attribute slot.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #append_byte(byte) ⇒ Object
-
#initialize(target:, slot: nil, matched: 0) ⇒ KeywordToken
constructor
A new instance of KeywordToken.
- #parsed_value ⇒ Object
Constructor Details
#initialize(target:, slot: nil, matched: 0) ⇒ KeywordToken
Returns a new instance of KeywordToken.
294 295 296 |
# File 'lib/json_completer/scanners.rb', line 294 def initialize(target:, slot: nil, matched: 0) super end |
Instance Attribute Details
#matched ⇒ Object
Returns the value of attribute matched
293 294 295 |
# File 'lib/json_completer/scanners.rb', line 293 def matched @matched end |
#slot ⇒ Object
Returns the value of attribute slot
293 294 295 |
# File 'lib/json_completer/scanners.rb', line 293 def slot @slot end |
#target ⇒ Object
Returns the value of attribute target
293 294 295 |
# File 'lib/json_completer/scanners.rb', line 293 def target @target end |
Instance Method Details
#append_byte(byte) ⇒ Object
298 299 300 301 302 303 304 |
# File 'lib/json_completer/scanners.rb', line 298 def append_byte(byte) return false if matched >= target.length return false unless (byte | 0x20) == target.getbyte(matched) self.matched += 1 true end |
#parsed_value ⇒ Object
306 307 308 309 310 311 312 313 |
# File 'lib/json_completer/scanners.rb', line 306 def parsed_value case target when 'true' true when 'false' false end end |