Class: Paperclip::HttpUrlProxyAdapter

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

Constant Summary collapse

REGEXP =
/\Ahttps?:\/\//.freeze

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 = Paperclip::UrlGenerator.escape(target)
  super(URI(target == Paperclip::UrlGenerator.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