Class: Yoti::Image
- Inherits:
-
Object
- Object
- Yoti::Image
- Defined in:
- lib/yoti/data_type/image.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
Instance Method Summary collapse
- #base64_content ⇒ Object
-
#initialize(content, mime_type) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(content, mime_type) ⇒ Image
Returns a new instance of Image.
8 9 10 11 12 13 |
# File 'lib/yoti/data_type/image.rb', line 8 def initialize(content, mime_type) raise(TypeError, 'Image is an abstract class, so cannot be instantiated') if self.class == Yoti::Image @content = content @mime_type = mime_type end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/yoti/data_type/image.rb', line 5 def content @content end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
6 7 8 |
# File 'lib/yoti/data_type/image.rb', line 6 def mime_type @mime_type end |
Instance Method Details
#base64_content ⇒ Object
15 16 17 |
# File 'lib/yoti/data_type/image.rb', line 15 def base64_content "data:#{mime_type};base64,#{Base64.strict_encode64(content)}" end |