Class: Paperclip::HttpUrlProxyAdapter

Inherits:
UriAdapter show all
Defined in:
lib/paperclip/io_adapters/http_url_proxy_adapter.rb

Constant Summary collapse

REGEXP =
/\Ahttps?:\/\//

Constants inherited from AbstractAdapter

AbstractAdapter::OS_RESTRICTED_CHARACTERS

Instance Attribute Summary

Attributes inherited from UriAdapter

#content_type

Attributes inherited from AbstractAdapter

#content_type, #original_filename, #size, #tempfile

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#assignment?, #fingerprint, #inspect, #nil?, #read

Constructor Details

#initialize(target, options = {}) ⇒ HttpUrlProxyAdapter

Returns a new instance of HttpUrlProxyAdapter.



11
12
13
14
# File 'lib/paperclip/io_adapters/http_url_proxy_adapter.rb', line 11

def initialize(target, options = {})
  escaped = URI.escape(target)
  super(URI(target == URI.unescape(target) ? escaped : target), options)
end

Class Method Details

.registerObject



3
4
5
6
7
# File 'lib/paperclip/io_adapters/http_url_proxy_adapter.rb', line 3

def self.register
  Paperclip.io_adapters.register self do |target|
    String === target && target =~ REGEXP
  end
end