Class: Gotenberg::Utilities::InlineResource
- Inherits:
-
Object
- Object
- Gotenberg::Utilities::InlineResource
- Defined in:
- lib/gotenberg/utilities/inline_resource.rb
Constant Summary collapse
- MIME_TYPES =
{ 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'png' => 'image/png', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jfif' => 'image/pipeg', 'svg' => 'image/svg+xml', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'ico' => 'image/x-icon', 'eot' => 'application/vnd.ms-fontobject', 'otf' => 'application/font-sfnt', 'ttf' => 'application/font-sfnt', 'woff' => 'application/font-woff', 'woff2' => 'application/font-woff2', }.freeze
Instance Attribute Summary collapse
-
#binary ⇒ Object
readonly
Returns the value of attribute binary.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(filename, binary) ⇒ InlineResource
constructor
A new instance of InlineResource.
Constructor Details
#initialize(filename, binary) ⇒ InlineResource
Returns a new instance of InlineResource.
27 28 29 30 |
# File 'lib/gotenberg/utilities/inline_resource.rb', line 27 def initialize filename, binary @filename = filename @binary = binary end |
Instance Attribute Details
#binary ⇒ Object (readonly)
Returns the value of attribute binary.
25 26 27 |
# File 'lib/gotenberg/utilities/inline_resource.rb', line 25 def binary @binary end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
25 26 27 |
# File 'lib/gotenberg/utilities/inline_resource.rb', line 25 def filename @filename end |
Instance Method Details
#call ⇒ Object
32 33 34 |
# File 'lib/gotenberg/utilities/inline_resource.rb', line 32 def call 'data:%s;base64,%s' % [mimetype, Base64.strict_encode64(binary)] end |