Class: Lookbook::DataUriEncoder

Inherits:
Service
  • Object
show all
Defined in:
lib/lookbook/services/urls/data_uri_encoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(str, mime_type) ⇒ DataUriEncoder

Returns a new instance of DataUriEncoder.



5
6
7
8
# File 'lib/lookbook/services/urls/data_uri_encoder.rb', line 5

def initialize(str, mime_type)
  @str = str
  @mime_type = mime_type
end

Instance Attribute Details

#mime_typeObject (readonly)



3
4
5
# File 'lib/lookbook/services/urls/data_uri_encoder.rb', line 3

def mime_type
  @mime_type
end

#strObject (readonly)



3
4
5
# File 'lib/lookbook/services/urls/data_uri_encoder.rb', line 3

def str
  @str
end

Instance Method Details

#callObject



10
11
12
# File 'lib/lookbook/services/urls/data_uri_encoder.rb', line 10

def call
  "data:#{mime_type},#{ERB::Util.url_encode(str)}"
end