Created
February 2, 2016 21:08
-
-
Save dugancathal/d149126a8c7827fadfbb to your computer and use it in GitHub Desktop.
Wrapping HTTParty for more logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
class HTTPGetter | |
include HTTParty | |
base_uri 'http://google.com' | |
end | |
class LoggingDecorator < SimpleDelegator | |
def initialize(thing, logger) | |
super(thing) | |
@logger = logger | |
end | |
def get | |
__getobj__.get("/") | |
end | |
end | |
puts LoggingDecorator.new(HTTPGetter, NullLogger.new).get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment