Class: Odf::Component::ImageSet::Image
- Inherits:
-
Object
- Object
- Odf::Component::ImageSet::Image
- Defined in:
- lib/odf/component/image_set.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(uri) ⇒ Image
constructor
A new instance of Image.
- #save ⇒ Object
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_type ⇒ Object (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 |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/odf/component/image_set.rb', line 5 def path @path end |
#uri ⇒ Object (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
#content ⇒ Object
17 18 19 |
# File 'lib/odf/component/image_set.rb', line 17 def content @content || (save && @content) end |
#save ⇒ Object
13 14 15 |
# File 'lib/odf/component/image_set.rb', line 13 def save @content, @content_type = Odf::Utils::File.fetch_image(self) end |