123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Comment

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

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(string:, location:) ⇒ Comment

[ GitHub ]

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

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

Instance Attribute Details

#location (readonly)

[ GitHub ]

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

attr_reader :location

#string (readonly)

[ GitHub ]

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

attr_reader :string

Instance Method Details

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

[ GitHub ]

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

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

#eql?(other)

Alias for #==.

[ GitHub ]

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

alias eql? ==

#hash

[ GitHub ]

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

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

#to_json(state = _ = nil)

[ GitHub ]

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

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