Class: RBS::Constant

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/constant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type:, entry:) ⇒ Constant

Returns a new instance of Constant.



9
10
11
12
13
# File 'lib/rbs/constant.rb', line 9

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

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



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

def entry
  @entry
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

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



15
16
17
18
19
20
# File 'lib/rbs/constant.rb', line 15

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

#hashObject



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

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