Class: Eg::AllPairs::Pair
- Inherits:
-
Object
- Object
- Eg::AllPairs::Pair
- Defined in:
- lib/eg/all_pairs.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#used ⇒ Object
Returns the value of attribute used.
Instance Method Summary collapse
- #<=>(obj) ⇒ Object
-
#initialize(left, right) ⇒ Pair
constructor
A new instance of Pair.
- #is_fit?(slug) ⇒ Boolean
- #rank ⇒ Object
Constructor Details
#initialize(left, right) ⇒ Pair
Returns a new instance of Pair.
153 154 155 156 |
# File 'lib/eg/all_pairs.rb', line 153 def initialize left, right @left, @right = left, right @used = 0 end |
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left.
151 152 153 |
# File 'lib/eg/all_pairs.rb', line 151 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
151 152 153 |
# File 'lib/eg/all_pairs.rb', line 151 def right @right end |
#used ⇒ Object
Returns the value of attribute used.
152 153 154 |
# File 'lib/eg/all_pairs.rb', line 152 def used @used end |
Instance Method Details
#<=>(obj) ⇒ Object
163 164 165 |
# File 'lib/eg/all_pairs.rb', line 163 def <=> obj rank - obj.rank end |
#is_fit?(slug) ⇒ Boolean
157 158 159 |
# File 'lib/eg/all_pairs.rb', line 157 def is_fit? slug @left.is_fit?(slug) and @right.is_fit?(slug) end |