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 7

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

Instance Attribute Details

#location (readonly)

[ GitHub ]

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

attr_reader :location

#string (readonly)

[ GitHub ]

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

attr_reader :string

Instance Method Details

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

[ GitHub ]

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

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

#eql?(other)

Alias for #==.

[ GitHub ]

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

alias eql? ==

#hash

[ GitHub ]

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

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

#to_json(state = _ = nil)

[ GitHub ]

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

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