Class: Paperclip::NilAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/paperclip/io_adapters/nil_adapter.rb

Constant Summary

Constants inherited from AbstractAdapter

AbstractAdapter::OS_RESTRICTED_CHARACTERS

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#tempfile

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#assignment?, #fingerprint, #inspect

Constructor Details

#initialize(_target, _options = {}) ⇒ NilAdapter

Returns a new instance of NilAdapter.



9
# File 'lib/paperclip/io_adapters/nil_adapter.rb', line 9

def initialize(_target, _options = {}); end

Class Method Details

.registerObject



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

def self.register
  Paperclip.io_adapters.register self do |target|
    target.nil? || ((Paperclip::Attachment === target) && !target.present?)
  end
end

Instance Method Details

#content_typeObject



15
16
17
# File 'lib/paperclip/io_adapters/nil_adapter.rb', line 15

def content_type
  ""
end

#eof?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/paperclip/io_adapters/nil_adapter.rb', line 31

def eof?
  true
end

#nil?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/paperclip/io_adapters/nil_adapter.rb', line 23

def nil?
  true
end

#original_filenameObject



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

def original_filename
  ""
end

#read(*_args) ⇒ Object



27
28
29
# File 'lib/paperclip/io_adapters/nil_adapter.rb', line 27

def read(*_args)
  nil
end

#sizeObject



19
20
21
# File 'lib/paperclip/io_adapters/nil_adapter.rb', line 19

def size
  0
end