Class: Goby::C
- Inherits:
-
Object
- Object
- Goby::C
- Defined in:
- lib/goby/util.rb
Overview
Stores a pair of values as a couple.
Instance Attribute Summary collapse
-
#first ⇒ Object
Returns the value of attribute first.
-
#second ⇒ Object
Returns the value of attribute second.
Class Method Summary collapse
-
.[](first, second) ⇒ Object
Syntactic sugar to create a couple using C[a, b].
Instance Method Summary collapse
- #==(rhs) ⇒ Object
-
#initialize(first, second) ⇒ C
constructor
A new instance of C.
Constructor Details
#initialize(first, second) ⇒ C
Returns a new instance of C.
21 22 23 24 |
# File 'lib/goby/util.rb', line 21 def initialize(first, second) @first = first @second = second end |
Instance Attribute Details
#first ⇒ Object
Returns the value of attribute first.
31 32 33 |
# File 'lib/goby/util.rb', line 31 def first @first end |
#second ⇒ Object
Returns the value of attribute second.
31 32 33 |
# File 'lib/goby/util.rb', line 31 def second @second end |
Class Method Details
Instance Method Details
#==(rhs) ⇒ Object
27 28 29 |
# File 'lib/goby/util.rb', line 27 def ==(rhs) return ((@first == rhs.first) && (@second == rhs.second)) end |