lib/zold/copies.rb in zold-0.3.3 vs lib/zold/copies.rb in zold-0.3.4
- old
+ new
@@ -47,9 +47,13 @@
Dir.new(@dir).select { |f| f =~ /[0-9]+/ }.each do |f|
File.delete(File.join(@dir, f)) if list.find { |s| s[:name] == f }.nil?
end
end
+ def remove(host, port)
+ save(load.reject! { |s| s[:host] == host && s[:port] == port })
+ end
+
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)