-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
e.g. Make the value stored at KEY identical to the given list.
familia/lib/familia/redisobject.rb
Lines 468 to 489 in 029675c
def last | |
at(-1) | |
end | |
# TODO: def replace | |
## Make the value stored at KEY identical to the given list | |
# define_method :"#{name}_sync" do |*latest| | |
# latest = latest.flatten.compact | |
# # Do nothing if we're given an empty Array. | |
# # Otherwise this would clear all current values | |
# if latest.empty? | |
# false | |
# else | |
# # Convert to a list of index values if we got the actual objects | |
# latest = latest.collect { |obj| obj.index } if klass === latest.first | |
# current = send("#{name_plural}raw") | |
# added = latest-current | |
# removed = current-latest | |
# #Familia.info "#{self.index}: adding: #{added}" | |
# added.each { |v| self.send("add_#{name_singular}", v) } | |
# #Familia.info "#{self.index}: removing: #{removed}" | |
# removed.each { |v| self.send("remove_#{name_singular}", v) } |
# TODO: def replace
## Make the value stored at KEY identical to the given list
# define_method :"#{name}_sync" do |*latest|
# latest = latest.flatten.compact
# # Do nothing if we're given an empty Array.
# # Otherwise this would clear all current values
# if latest.empty?
# false
# else
# # Convert to a list of index values if we got the actual objects
# latest = latest.collect { |obj| obj.index } if klass === latest.first
# current = send("#{name_plural}raw")
# added = latest-current
# removed = current-latest
# #Familia.info "#{self.index}: adding: #{added}"
# added.each { |v| self.send("add_#{name_singular}", v) }
# #Familia.info "#{self.index}: removing: #{removed}"
# removed.each { |v| self.send("remove_#{name_singular}", v) }
# true
# end
# end
Metadata
Metadata
Assignees
Labels
No labels