Class: EmbeddableContent::Images::ImageDownloader
- Inherits:
-
Object
- Object
- EmbeddableContent::Images::ImageDownloader
- Defined in:
- app/services/embeddable_content/images/image_downloader.rb
Instance Attribute Summary collapse
-
#attached_image ⇒ Object
readonly
Returns the value of attribute attached_image.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(attached_image) ⇒ ImageDownloader
constructor
A new instance of ImageDownloader.
- #raw_svg ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(attached_image) ⇒ ImageDownloader
Returns a new instance of ImageDownloader.
8 9 10 |
# File 'app/services/embeddable_content/images/image_downloader.rb', line 8 def initialize(attached_image) @attached_image = attached_image end |
Instance Attribute Details
#attached_image ⇒ Object (readonly)
Returns the value of attribute attached_image.
4 5 6 |
# File 'app/services/embeddable_content/images/image_downloader.rb', line 4 def attached_image @attached_image end |
Instance Method Details
#delete ⇒ Object
16 17 18 |
# File 'app/services/embeddable_content/images/image_downloader.rb', line 16 def delete image_file.delete if image_file.exist? end |
#raw_svg ⇒ Object
20 21 22 |
# File 'app/services/embeddable_content/images/image_downloader.rb', line 20 def raw_svg @raw_svg ||= downloaded_image_data if svg_attached? end |
#save ⇒ Object
12 13 14 |
# File 'app/services/embeddable_content/images/image_downloader.rb', line 12 def save image_file.tap { |file| file.write raw_image_data } end |