jeremyboles-graffic 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/graffic.rb +7 -7
- metadata +1 -1
data/lib/graffic.rb
CHANGED
@@ -98,6 +98,13 @@ class Graffic < ActiveRecord::Base
|
|
98
98
|
attributes['format'] || self.class.format
|
99
99
|
end
|
100
100
|
|
101
|
+
def image
|
102
|
+
@image ||= case self.state
|
103
|
+
when 'moved': Magick::Image.read(tmp_file_path).first
|
104
|
+
when 'uploaded', 'processed': Magick::Image.from_blob(bucket.get(uploaded_file_path)).first
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
101
108
|
# Move the file to the temporary directory
|
102
109
|
def move!
|
103
110
|
move_without_queue!
|
@@ -213,13 +220,6 @@ protected
|
|
213
220
|
self.errors.add(:file, 'not included. You need a file when creating.') if @file.nil?
|
214
221
|
end
|
215
222
|
|
216
|
-
def image
|
217
|
-
@image ||= case self.state
|
218
|
-
when 'moved': Magick::Image.read(tmp_file_path).first
|
219
|
-
when 'uploaded', 'processed': Magick::Image.from_blob(bucket.get(uploaded_file_path)).first
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
223
|
# Return the file extension based on the type
|
224
224
|
def extension(atype = nil)
|
225
225
|
(atype || format).to_s
|