Class: Paperclip::DataUriAdapter

Inherits:
StringioAdapter show all
Defined in:
lib/paperclip/io_adapters/data_uri_adapter.rb

Constant Summary collapse

REGEXP =
/\Adata:([-\w]+\/[-\w\+\.]+)?;base64,(.*)/m.freeze

Constants inherited from AbstractAdapter

AbstractAdapter::OS_RESTRICTED_CHARACTERS

Instance Attribute Summary

Attributes inherited from StringioAdapter

#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_uri, options = {}) ⇒ DataUriAdapter

Returns a new instance of DataUriAdapter.



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

def initialize(target_uri, options = {})
  super(extract_target(target_uri), options)
end

Class Method Details

.registerObject



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

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