123456789_123456789_123456789_123456789_123456789_

Class: RBS::Constant

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

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name:, type:, entry:) ⇒ Constant

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 9

def initialize(name:, type:, entry:)
  @name = name
  @type = type
  @entry = entry
end

Instance Attribute Details

#entry (readonly)

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 7

attr_reader :entry

#name (readonly)

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 5

attr_reader :name

#type (readonly)

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 6

attr_reader :type

Instance Method Details

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

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 15

def ==(other)
  other.is_a?(Constant) &&
    other.name == name &&
    other.type == type &&
    other.entry == entry
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 22

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/constant.rb', line 24

def hash
  self.class.hash ^ name.hash ^ type.hash ^ entry.hash
end