Class: Junkfood::PaperclipStringIo
- Inherits:
-
StringIO
- Object
- StringIO
- Junkfood::PaperclipStringIo
- Defined in:
- lib/junkfood/paperclip_string_io.rb
Overview
Adapter to save blobs of in-memory data into paperclip enabled ActiveRecord models without requiring the use of temporary files.
Constant Summary collapse
- DEFAULT_FILENAME =
Default filename
'unnamed'
- DEFAULT_CONTENT_TYPE =
Default file content_type
'application/octet-stream'
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#original_filename ⇒ Object
readonly
Returns the value of attribute original_filename.
Instance Method Summary collapse
-
#initialize(string, options = {}) ⇒ PaperclipStringIo
constructor
A new instance of PaperclipStringIo.
Constructor Details
#initialize(string, options = {}) ⇒ PaperclipStringIo
Returns a new instance of PaperclipStringIo.
60 61 62 63 64 |
# File 'lib/junkfood/paperclip_string_io.rb', line 60 def initialize(string, ={}) super(string) @original_filename = [:filename] || DEFAULT_FILENAME @content_type = [:content_type] || DEFAULT_CONTENT_TYPE end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
45 46 47 |
# File 'lib/junkfood/paperclip_string_io.rb', line 45 def content_type @content_type end |
#original_filename ⇒ Object (readonly)
Returns the value of attribute original_filename.
45 46 47 |
# File 'lib/junkfood/paperclip_string_io.rb', line 45 def original_filename @original_filename end |