media file: memoize expensive methods in subclasses.

This commit is contained in:
evazion
2020-05-27 14:31:39 -05:00
parent 84cd8540ab
commit f94c52478c
5 changed files with 7 additions and 4 deletions

View File

@@ -63,6 +63,8 @@ class MediaFile::Image < MediaFile
end
def image
@image ||= Vips::Image.new_from_file(file.path, fail: true)
Vips::Image.new_from_file(file.path, fail: true)
end
memoize :image, :dimensions, :is_corrupt?, :is_animated_gif?, :is_animated_png?
end