Class: Cacchern::IncrementableSortedSet
- Defined in:
- lib/cacchern/incrementable_sorted_set.rb
Instance Attribute Summary
Attributes inherited from SortedSet
Instance Method Summary collapse
Methods inherited from SortedSet
#add, #add_all, contain_class, #get, #initialize, #order, #remove, #remove_all, value_class
Constructor Details
This class inherits a constructor from Cacchern::SortedSet
Instance Method Details
#increment(value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cacchern/incrementable_sorted_set.rb', line 7 def increment(value) return false unless value.instance_of?(self.class.contain_class) if value.valid? Redis.current.zincrby @key, value.value, value.key true else false end end |
#increment_all(values) ⇒ Object
18 19 20 |
# File 'lib/cacchern/incrementable_sorted_set.rb', line 18 def increment_all(values) values.each { |value| increment(value) } end |