Class: Ice::Identity
- Inherits:
-
Object
- Object
- Ice::Identity
- Includes:
- Inspect_mixin
- Defined in:
- ruby/Ice/Identity.rb,
ruby/Ice/IdentitySpaceship.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name = '', category = "") ⇒ Identity
constructor
A new instance of Identity.
Methods included from Inspect_mixin
Constructor Details
#initialize(name = '', category = "") ⇒ Identity
Returns a new instance of Identity.
12 13 14 15 |
# File 'ruby/Ice/Identity.rb', line 12 def initialize(name='', category="") @name = name @category = category end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
35 36 37 |
# File 'ruby/Ice/Identity.rb', line 35 def category @category end |
#name ⇒ Object
Returns the value of attribute name.
35 36 37 |
# File 'ruby/Ice/Identity.rb', line 35 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'ruby/Ice/IdentitySpaceship.rb', line 7 def <=>(other) n = self.name <=> other.name if n == 0 return self.category <=> other.category else return n end end |
#==(other) ⇒ Object
24 25 26 27 28 29 |
# File 'ruby/Ice/Identity.rb', line 24 def ==(other) return false if !other.is_a? ::Ice::Identity or @name != other.name or @category != other.category true end |
#eql?(other) ⇒ Boolean
31 32 33 |
# File 'ruby/Ice/Identity.rb', line 31 def eql?(other) return other.class == self.class && other == self end |
#hash ⇒ Object
17 18 19 20 21 22 |
# File 'ruby/Ice/Identity.rb', line 17 def hash _h = 0 _h = 5 * _h + @name.hash _h = 5 * _h + @category.hash _h % 0x7fffffff end |