Module: FileModel::MiniMagic
Instance Method Summary collapse
Instance Method Details
#mini_magic(callback, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/file_model/mini_magic.rb', line 2 def mini_magic callback, &block return unless original require 'mini_magick' image = MiniMagick::Image.open(original.path) block.call image '/'.to_entry.tmp do |dir| output = dir / :tmp_image image.write output.path callback.call output end end |