Class: MiHash
- Inherits:
-
Object
- Object
- MiHash
- Defined in:
- lib/matrc/mihash.rb
Instance Attribute Summary collapse
-
#c ⇒ Object
Returns the value of attribute c.
-
#r ⇒ Object
Returns the value of attribute r.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(r, c) ⇒ MiHash
constructor
A new instance of MiHash.
Constructor Details
#initialize(r, c) ⇒ MiHash
Returns a new instance of MiHash.
5 6 7 |
# File 'lib/matrc/mihash.rb', line 5 def initialize(r,c) @r, @c = r, c end |
Instance Attribute Details
#c ⇒ Object
Returns the value of attribute c.
3 4 5 |
# File 'lib/matrc/mihash.rb', line 3 def c @c end |
#r ⇒ Object
Returns the value of attribute r.
3 4 5 |
# File 'lib/matrc/mihash.rb', line 3 def r @r end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 20 21 |
# File 'lib/matrc/mihash.rb', line 17 def ==(other) self.class === other and other.c == @c and other.r == @r end |
#eql?(other) ⇒ Boolean
9 10 11 |
# File 'lib/matrc/mihash.rb', line 9 def eql?(other) (@r == other.r) && (@c == other.c) end |
#hash ⇒ Object
13 14 15 |
# File 'lib/matrc/mihash.rb', line 13 def hash @r.hash ^ @c.hash end |