Class: Ibex::Runtime::SyntaxSessionDiagnostic

Inherits:
Object
  • Object
show all
Defined in:
lib/json5/generated_parser.rb

Overview

Immutable, data-only copy of one parser diagnostic. Application-owned values and locations are sanitized rather than retained by identity.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, data:) ⇒ SyntaxSessionDiagnostic

Returns a new instance of SyntaxSessionDiagnostic.

RBS:

  • (kind: Symbol, data: Hash[Object?, Object?]) -> void

Raises:

  • (ArgumentError)


4074
4075
4076
4077
4078
4079
4080
4081
# File 'lib/json5/generated_parser.rb', line 4074

def initialize(kind:, data:)
  raise ArgumentError, "diagnostic kind must be a Symbol" unless kind.is_a?(Symbol)
  raise ArgumentError, "diagnostic data must be a Hash" unless data.is_a?(Hash)

  @kind = kind
  @data = EventSanitizer.data(data)
  freeze
end

Instance Attribute Details

#dataObject (readonly)

Signature:

  • Hash[String, EventSanitizer::json_value]



4071
4072
4073
# File 'lib/json5/generated_parser.rb', line 4071

def data
  @data
end

#kindObject (readonly)

Signature:

  • Symbol



4070
4071
4072
# File 'lib/json5/generated_parser.rb', line 4070

def kind
  @kind
end

Instance Method Details

#to_hObject

RBS:

  • () -> Hash[String, EventSanitizer::json_value]



4084
4085
4086
# File 'lib/json5/generated_parser.rb', line 4084

def to_h
  @data
end