Class: Prism::LexCompat::Result

Inherits:
Result
  • Object
show all
Defined in:
lib/prism/lex_compat.rb

Overview

A result class specialized for holding tokens produced by the lexer.

Instance Attribute Summary collapse

Attributes inherited from Result

#comments, #data_loc, #errors, #magic_comments, #source, #warnings

Instance Method Summary collapse

Methods inherited from Result

#code_units_cache, #encoding, #failure?, #success?

Constructor Details

#initialize(value, comments, magic_comments, data_loc, errors, warnings, source) ⇒ Result

Create a new lex compat result object with the given values.



19
20
21
22
# File 'lib/prism/lex_compat.rb', line 19

def initialize(value, comments, magic_comments, data_loc, errors, warnings, source)
  @value = value
  super(comments, magic_comments, data_loc, errors, warnings, source)
end

Instance Attribute Details

#valueObject (readonly)

The list of tokens that were produced by the lexer.



16
17
18
# File 'lib/prism/lex_compat.rb', line 16

def value
  @value
end

Instance Method Details

#deconstruct_keys(keys) ⇒ Object

Implement the hash pattern matching interface for Result.



25
26
27
# File 'lib/prism/lex_compat.rb', line 25

def deconstruct_keys(keys)
  super.merge!(value: value)
end