Class: Odf::Component::ImageSet::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/odf/component/image_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Image

Returns a new instance of Image.



7
8
9
10
11
# File 'lib/odf/component/image_set.rb', line 7

def initialize(uri)
  @uri   = uri
  digest = OpenSSL::Digest::MD5.hexdigest(uri)
  @path = "Pictures/#{digest}"
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/odf/component/image_set.rb', line 5

def content_type
  @content_type
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/odf/component/image_set.rb', line 5

def path
  @path
end

#uriObject (readonly)

Returns the value of attribute uri.



5
6
7
# File 'lib/odf/component/image_set.rb', line 5

def uri
  @uri
end

Instance Method Details

#contentObject



17
18
19
# File 'lib/odf/component/image_set.rb', line 17

def content
  @content || (save && @content)
end

#saveObject



13
14
15
# File 'lib/odf/component/image_set.rb', line 13

def save
  @content, @content_type = Odf::Utils::File.fetch_image(self)
end