123456789_123456789_123456789_123456789_123456789_

Class: RBS::Types::Literal

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: lib/rbs/types.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(literal:, location:) ⇒ Literal

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1194

def initialize(literal:, location:)
  @literal = literal
  @location = location
end

Instance Attribute Details

#literal (readonly)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1191

attr_reader :literal

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1192

attr_reader :location

Instance Method Details

#==(other) Also known as: #eql?

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1199

def ==(other)
  other.is_a?(Literal) && other.literal == literal
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1203

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1205

def hash
  self.class.hash ^ literal.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1214

def to_json(state = _ = nil)
  { class: :literal, literal: literal.inspect, location: location }.to_json(state)
end

#to_s(level = 0)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 1218

def to_s(level = 0)
  literal.inspect
end