Class: ActiveRedis::DirtyObjects::SortedSet
- Defined in:
- lib/active_redis/dirty_objects/sorted_set.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#original ⇒ Object
readonly
Returns the value of attribute original.
Instance Method Summary collapse
Methods inherited from Array
Constructor Details
This class inherits a constructor from ActiveRedis::DirtyObjects::Array
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
4 5 6 |
# File 'lib/active_redis/dirty_objects/sorted_set.rb', line 4 def hash @hash end |
#original ⇒ Object (readonly)
Returns the value of attribute original.
5 6 7 |
# File 'lib/active_redis/dirty_objects/sorted_set.rb', line 5 def original @original end |
Instance Method Details
#[]=(score, value) ⇒ Object
7 8 9 10 11 |
# File 'lib/active_redis/dirty_objects/sorted_set.rb', line 7 def []=(score, value) self.push(score) @hash ||= {} @hash[value] = score end |
#changes ⇒ Object
22 23 24 |
# File 'lib/active_redis/dirty_objects/sorted_set.rb', line 22 def changes super.merge(hash: @hash) end |
#replace(hash) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/active_redis/dirty_objects/sorted_set.rb', line 13 def replace(hash) @hash = hash self.clear hash.values.each do |value| self.push(value) end hash end |