Class: Prez::DataUri

Inherits:
Object
  • Object
show all
Defined in:
lib/prez/data_uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentsObject (readonly)

Returns the value of attribute contents.



5
6
7
# File 'lib/prez/data_uri.rb', line 5

def contents
  @contents
end

#typeObject (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_sObject



13
14
15
# File 'lib/prez/data_uri.rb', line 13

def to_s
  "data:#{type};base64,#{contents}"
end