Module: Fetch::Simple
- Defined in:
- lib/fetch/simple.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fetch/simple.rb', line 3 def self.included(base) base.define_callback :url, :timeout, :user_agent, :headers, :process base.request do |req| req.url = url req.timeout = timeout if callback?(:timeout) req.user_agent = user_agent if callback?(:user_agent) req.headers.merge!(headers) if callback?(:headers) req.process do |body, url, final_url| process(body, url, final_url) end end end |