Sha256: 36b6970faa316a105fc8e2a3680dcbc42749953c5a09358ef20129d1e666bd73
Contents?: true
Size: 814 Bytes
Versions: 1
Compression:
Stored size: 814 Bytes
Contents
module Search # Use this class to extend the hash the serializer returns. # module Convenience # Are there any allocations? # def empty? allocations.empty? end # Returns the topmost limit results. # def ids limit = 20 ids = [] allocations.each { |allocation| allocation[4].each { |id| break if ids.size > limit; ids << id } } ids end # Removes the ids from each allocation. # def clear_ids allocations.each { |allocation| allocation[4].clear } end # Caching readers. # def allocations @allocations || @allocations = self[:allocations] end def allocations_size @allocations_size || @allocations_size = allocations.size end def total @total || @total = self[:total] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
picky-client-0.0.0 | lib/search/convenience.rb |