Class: Shrine::DataFile
- Inherits:
-
Object
- Object
- Shrine::DataFile
- Extended by:
- Forwardable
- Defined in:
- lib/shrine/plugins/data_uri.rb
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
- #close ⇒ Object
-
#initialize(content, content_type: nil, filename: nil) ⇒ DataFile
constructor
A new instance of DataFile.
- #to_io ⇒ Object
Constructor Details
#initialize(content, content_type: nil, filename: nil) ⇒ DataFile
Returns a new instance of DataFile.
159 160 161 162 163 |
# File 'lib/shrine/plugins/data_uri.rb', line 159 def initialize(content, content_type: nil, filename: nil) @content_type = content_type @original_filename = filename @io = StringIO.new(content) end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
157 158 159 |
# File 'lib/shrine/plugins/data_uri.rb', line 157 def content_type @content_type end |
#original_filename ⇒ Object (readonly)
Returns the value of attribute original_filename.
157 158 159 |
# File 'lib/shrine/plugins/data_uri.rb', line 157 def original_filename @original_filename end |
Instance Method Details
#close ⇒ Object
172 173 174 175 |
# File 'lib/shrine/plugins/data_uri.rb', line 172 def close @io.close @io.string.clear # deallocate string end |
#to_io ⇒ Object
165 166 167 |
# File 'lib/shrine/plugins/data_uri.rb', line 165 def to_io @io end |