Class: RBS::Constant
- Inherits:
-
Object
- Object
- RBS::Constant
- Defined in:
- lib/rbs/constant.rb
Instance Attribute Summary collapse
-
#declaration ⇒ Object
readonly
Returns the value of attribute declaration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, type:, entry:) ⇒ Constant
constructor
A new instance of Constant.
Constructor Details
#initialize(name:, type:, entry:) ⇒ Constant
Returns a new instance of Constant.
7 8 9 10 11 |
# File 'lib/rbs/constant.rb', line 7 def initialize(name:, type:, entry:) @name = name @type = type @entry = entry end |
Instance Attribute Details
#declaration ⇒ Object (readonly)
Returns the value of attribute declaration.
5 6 7 |
# File 'lib/rbs/constant.rb', line 5 def declaration @declaration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rbs/constant.rb', line 3 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/rbs/constant.rb', line 4 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
13 14 15 16 17 18 |
# File 'lib/rbs/constant.rb', line 13 def ==(other) other.is_a?(Constant) && other.name == name && other.type == type && other.entry == entry end |
#hash ⇒ Object
22 23 24 |
# File 'lib/rbs/constant.rb', line 22 def hash self.class.hash ^ name.hash ^ type.hash ^ entry.hash end |