Class: RemoteImageFetch::CurlWrap
- Inherits:
-
Curl::Easy
- Object
- Curl::Easy
- RemoteImageFetch::CurlWrap
- Defined in:
- lib/remote_image_fetch/curl_wrap.rb
Overview
Wrap Curl::Easy with additional helper methods Can’t override initialize() as curb doesn’t call it properly.
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#fetcher ⇒ Object
Returns the value of attribute fetcher.
-
#redirect ⇒ Object
Returns the value of attribute redirect.
-
#redirects ⇒ Object
readonly
Returns the value of attribute redirects.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
6 7 8 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 6 def args @args end |
#callback ⇒ Object
Returns the value of attribute callback.
6 7 8 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 6 def callback @callback end |
#fetcher ⇒ Object
Returns the value of attribute fetcher.
6 7 8 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 6 def fetcher @fetcher end |
#redirect ⇒ Object
Returns the value of attribute redirect.
6 7 8 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 6 def redirect @redirect end |
#redirects ⇒ Object (readonly)
Returns the value of attribute redirects.
5 6 7 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 5 def redirects @redirects end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
5 6 7 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 5 def result @result end |
Instance Method Details
#body_io ⇒ Object
17 18 19 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 17 def body_io @body_io ||= StringIO.new(body_str) end |
#report(result) ⇒ Object
21 22 23 24 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 21 def report(result) @result = result callback.call(result, *args) if callback end |
#setup(fetcher) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/remote_image_fetch/curl_wrap.rb', line 8 def setup(fetcher) self.follow_location = false @fetcher = fetcher @redirects = 0 on_complete(&method(:handle_complete)) on_redirect(&method(:handle_redirect)) end |