Class: Archive::Pecan::Blob
- Inherits:
-
Object
- Object
- Archive::Pecan::Blob
- Defined in:
- lib/archive/pecan/blob.rb
Overview
Abstract representation of a binary blob in an component archive.
Instance Attribute Summary collapse
-
#blob ⇒ #read
Blob of binary data.
-
#mime_type ⇒ String
MIME type of the data contained in the blob.
Instance Method Summary collapse
-
#initialize(mime_type, blob) ⇒ Blob
constructor
Initializes the blob object with data.
-
#to_s ⇒ String
String representation of the binary blob.
- #to_str ⇒ Object
Constructor Details
#initialize(mime_type, blob) ⇒ Blob
Initializes the blob object with data.
22 23 24 25 |
# File 'lib/archive/pecan/blob.rb', line 22 def initialize(mime_type, blob) @mime_type = mime_type @blob = blob end |
Instance Attribute Details
#blob ⇒ #read
Returns Blob of binary data.
16 17 18 |
# File 'lib/archive/pecan/blob.rb', line 16 def blob @blob end |
#mime_type ⇒ String
Returns MIME type of the data contained in the blob.
13 14 15 |
# File 'lib/archive/pecan/blob.rb', line 13 def mime_type @mime_type end |
Instance Method Details
#to_s ⇒ String
String representation of the binary blob.
30 31 32 |
# File 'lib/archive/pecan/blob.rb', line 30 def to_s "data:#{@mime_type};charset=utf-8;base64,#{Base64.encode64(@blob)}" end |
#to_str ⇒ Object
35 36 37 |
# File 'lib/archive/pecan/blob.rb', line 35 def to_str to_s end |