Class: Ocelot::Pair

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#aObject

Returns the value of attribute a.



3
4
5
# File 'lib/ocelot.rb', line 3

def a
  @a
end

#bObject

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

Returns:

  • (Boolean)


15
16
17
# File 'lib/ocelot.rb', line 15

def eql?(o)
  o.a.eql? a and o.b.eql? b
end

#hashObject



11
12
13
# File 'lib/ocelot.rb', line 11

def hash
  return a.hash * 31 + b.hash
end