require 'net/http'
module Cheat
extend self # the magic ingredient
def host
@host ||= 'http://cheat.errtheblog.com/'
end
def http
@http ||= Net::HTTP.start(URI.parse(host).host)
end
def sheet(name)
http.get("/s/#{name}").body
end
end
# use it
Cheat.sheet 'migrations'
Cheat.sheet 'singletons'
Posted to makandra dev (2014-08-12 17:37)