Sha256: 26e6f4db41d165ff61a471f6774bed19fe82c9c853e32b12abbccd69f5e9b7a3
Contents?: true
Size: 813 Bytes
Versions: 3
Compression:
Stored size: 813 Bytes
Contents
module Picky # 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
picky-client-0.0.3 | lib/picky-client/convenience.rb |
picky-client-0.0.2 | lib/picky-client/convenience.rb |
picky-client-0.0.1 | lib/picky-client/convenience.rb |