Class: Prez::DataUri
- Inherits:
-
Object
- Object
- Prez::DataUri
- Defined in:
- lib/prez/data_uri.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, contents) ⇒ DataUri
constructor
A new instance of DataUri.
- #to_s ⇒ Object
Constructor Details
#initialize(type, contents) ⇒ DataUri
Returns a new instance of DataUri.
7 8 9 10 11 |
# File 'lib/prez/data_uri.rb', line 7 def initialize(type, contents) @type = type @contents = Base64.encode64 contents @contents.gsub! "\n", "" end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
5 6 7 |
# File 'lib/prez/data_uri.rb', line 5 def contents @contents end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/prez/data_uri.rb', line 5 def type @type end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/prez/data_uri.rb', line 13 def to_s "data:#{type};base64,#{contents}" end |