Class: ActiveArchiver::Base64Decode
- Inherits:
-
StringIO
- Object
- StringIO
- ActiveArchiver::Base64Decode
- Defined in:
- lib/active_archiver/base64_decode.rb
Class Method Summary collapse
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(blob, content_type, file_name) ⇒ Base64Decode
constructor
A new instance of Base64Decode.
- #original_filename ⇒ Object
Constructor Details
#initialize(blob, content_type, file_name) ⇒ Base64Decode
Returns a new instance of Base64Decode.
13 14 15 16 17 18 |
# File 'lib/active_archiver/base64_decode.rb', line 13 def initialize(blob, content_type, file_name) super(blob) @content_type = content_type @file_name = file_name self end |
Class Method Details
.create_from_canvas_base64(str, file_name) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/active_archiver/base64_decode.rb', line 3 def self.create_from_canvas_base64(str, file_name) return nil if str.nil? head, data = str.split(",", 2) return nil if data.nil? _, mime_type = head.split(/:|;/) bin = Base64.decode64(data) self.new(bin, mime_type, file_name) end |
Instance Method Details
#content_type ⇒ Object
24 25 26 |
# File 'lib/active_archiver/base64_decode.rb', line 24 def content_type @content_type end |
#original_filename ⇒ Object
20 21 22 |
# File 'lib/active_archiver/base64_decode.rb', line 20 def original_filename @file_name end |