Module: Async::Enumerable::Comparable
- Defined in:
- lib/async/enumerable/comparable.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer?
Compares with another enumerable.
-
#==(other) ⇒ Boolean
(also: #eql?)
Checks equality with another enumerable.
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/async/enumerable/comparable.rb', line 4 def self.included(base) base.include(::Comparable) end |
Instance Method Details
#<=>(other) ⇒ Integer?
Compares with another enumerable.
11 12 13 14 |
# File 'lib/async/enumerable/comparable.rb', line 11 def <=>(other) return nil unless other.respond_to?(:to_a) to_a <=> other.to_a end |
#==(other) ⇒ Boolean Also known as: eql?
Checks equality with another enumerable.
19 20 21 22 |
# File 'lib/async/enumerable/comparable.rb', line 19 def ==(other) return false unless other.respond_to?(:to_a) to_a == other.to_a end |