lib/zold/copies.rb in zold-0.13.42 vs lib/zold/copies.rb in zold-0.13.43
- old
+ new
@@ -52,10 +52,11 @@
def remove(host, port)
save(load.reject { |s| s[:host] == host && s[:port] == port })
end
+ # Returns the name of the copy
def add(content, host, port, score, time = Time.now)
raise "Content can't be empty" if content.empty?
raise 'TCP port must be of type Integer' unless port.is_a?(Integer)
raise "TCP port can't be negative: #{port}" if port < 0
raise 'Time must be of type Time' unless time.is_a?(Time)
@@ -86,9 +87,10 @@
port: port,
score: score,
time: time
}
save(list)
+ name
end
def all
load.group_by { |s| s[:name] }.map do |name, scores|
{