123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Annotation

Relationships & Source Files
Inherits: Object
Defined in: lib/rbs/ast/annotation.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(string:, location:) ⇒ Annotation

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 9

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

Instance Attribute Details

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 7

attr_reader :location

#string (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 6

attr_reader :string

Instance Method Details

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

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 14

def ==(other)
  other.is_a?(Annotation) && other.string == string
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 18

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 20

def hash
  self.class.hash ^ string.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/ast/annotation.rb', line 24

def to_json(state = _ = nil)
  { string: string, location: location }.to_json(state)
end