@deprecated Use a HTTP library such as
[Net::HTTP](http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/) or [Curb](http://curb.rubyforge.org/) instead.
# File lib/nanoc/extra/chick.rb, line 27 def initialize(options={}) # Get options @options = DEFAULT_OPTIONS.merge(options) @options[:cache] = DEFAULT_OPTIONS[:cache].merge(@options[:cache]) @options[:cache_controller] = DEFAULT_OPTIONS[:cache_controller].merge(@options[:cache_controller]) end
# File lib/nanoc/extra/chick.rb, line 34 def get(url) # Build app options = @options @app ||= Rack::Builder.new { use Rack::Cache, options[:cache].merge(:verbose => true) use Nanoc::Extra::CHiCk::CacheController, options[:cache_controller] run Nanoc::Extra::CHiCk::RackClient } # Build environment for request env = Rack::MockRequest.env_for(url, :method => 'GET') # Fetch puts "[CHiCk] Fetching #{url}..." if $DEBUG status, headers, body_parts = @app.call(env) puts "[CHiCk] #{url}: #{headers['X-Rack-Cache']}" if $DEBUG # Join body body = '' body_parts.each { |part| body << part } # Done [ status, headers, body ] end
Generated with the Darkfish Rdoc Generator 2.