lib/billy/proxy.rb in puffing-billy-0.1.3 vs lib/billy/proxy.rb in puffing-billy-0.2.0
- old
+ new
@@ -39,11 +39,11 @@
end
end
def stub(url, options = {})
ret = ProxyRequestStub.new(url, options)
- @stubs << ret
+ @stubs.unshift ret
ret
end
def reset
@stubs = []
@@ -51,16 +51,18 @@
def reset_cache
@cache.reset
end
+ def restore_cache
+ @cache.reset
+ @cache.load_dir
+ end
+
protected
def find_stub(method, url)
- @stubs.each do |stub|
- return stub if stub.matches?(method, url)
- end
- nil
+ @stubs.find {|stub| stub.matches?(method, url) }
end
def main_loop
EM.run do
EM.error_handler do |e|