Class: CassandraModel::ResultLimiter
- Inherits:
-
Object
- Object
- CassandraModel::ResultLimiter
- Includes:
- Enumerable
- Defined in:
- lib/cassandra_model/result_limiter.rb
Instance Method Summary collapse
- #==(rhs) ⇒ Object
- #each ⇒ Object
-
#initialize(enum, limit) ⇒ ResultLimiter
constructor
A new instance of ResultLimiter.
Constructor Details
#initialize(enum, limit) ⇒ ResultLimiter
Returns a new instance of ResultLimiter.
5 6 7 8 |
# File 'lib/cassandra_model/result_limiter.rb', line 5 def initialize(enum, limit) @enum = enum @limit = limit end |
Instance Method Details
#==(rhs) ⇒ Object
21 22 23 24 25 |
# File 'lib/cassandra_model/result_limiter.rb', line 21 def ==(rhs) rhs.is_a?(ResultLimiter) && enum == rhs.enum && limit == rhs.limit end |
#each ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/cassandra_model/result_limiter.rb', line 10 def each return to_enum(:each) unless block_given? @enum.each.with_index do |value, index| break if index >= @limit yield value end end |