Class: Ocelot::Pair
- Inherits:
-
Object
- Object
- Ocelot::Pair
- Defined in:
- lib/ocelot.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
Instance Method Summary collapse
- #eql?(o) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(a, b) ⇒ Pair
constructor
A new instance of Pair.
Constructor Details
#initialize(a, b) ⇒ Pair
Returns a new instance of Pair.
6 7 8 9 |
# File 'lib/ocelot.rb', line 6 def initialize(a,b) self.a = a self.b = b end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
3 4 5 |
# File 'lib/ocelot.rb', line 3 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
4 5 6 |
# File 'lib/ocelot.rb', line 4 def b @b end |
Instance Method Details
#eql?(o) ⇒ Boolean
15 16 17 |
# File 'lib/ocelot.rb', line 15 def eql?(o) o.a.eql? a and o.b.eql? b end |
#hash ⇒ Object
11 12 13 |
# File 'lib/ocelot.rb', line 11 def hash return a.hash * 31 + b.hash end |