lib/http-dump.rb in http-dump-0.0.1 vs lib/http-dump.rb in http-dump-0.1.0

- old
+ new

@@ -1,24 +1,23 @@ require "http-dump/version" -require 'webmock' class HTTPDump class << self attr_accessor :output, :quiet_format def enable!(options = {}) + require 'webmock' WebMock.enable!(options) WebMock.allow_net_connect!(options) WebMock.after_request do |request_signature, response| output.puts self.format(request_signature, response) end @enabled = true end def disable!(options = {}) WebMock.reset_callbacks - WebMock.disable_net_connect!(options) WebMock.disable!(options) @enabled = false end def dump(options = {}, &block) @@ -53,20 +52,6 @@ end res.join("\n") end end end - -__END__ - -#HTTPDump.enable! -require 'open-uri' -HTTPDump.quiet_formatt = true -HTTPDump.dump { - open('http://example.com').read -} -open('http://example.com').read - -HTTPDump.dump { - open('http://b.hatena.ne.jp/').read -}