Class: LinkThumbnailer::Processor
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- LinkThumbnailer::Processor
- Defined in:
- lib/link_thumbnailer/processor.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#redirect_count ⇒ Object
readonly
Returns the value of attribute redirect_count.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call(url = '', redirect_count = 0, headers = {}) ⇒ Object
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
11 12 13 14 15 16 |
# File 'lib/link_thumbnailer/processor.rb', line 11 def initialize @config = ::LinkThumbnailer.page.config @http = ::Net::HTTP::Persistent.new super(config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/link_thumbnailer/processor.rb', line 9 def config @config end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
9 10 11 |
# File 'lib/link_thumbnailer/processor.rb', line 9 def http @http end |
#redirect_count ⇒ Object (readonly)
Returns the value of attribute redirect_count.
9 10 11 |
# File 'lib/link_thumbnailer/processor.rb', line 9 def redirect_count @redirect_count end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/link_thumbnailer/processor.rb', line 8 def url @url end |
Instance Method Details
#call(url = '', redirect_count = 0, headers = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/link_thumbnailer/processor.rb', line 18 def call(url = '', redirect_count = 0, headers = {}) self.url = url @redirect_count = redirect_count raise ::LinkThumbnailer::RedirectLimit if too_many_redirections? with_valid_url do set_http_headers(headers) perform_request end end |