diff options
author | Jeffrey Guenther <guenther.jeffrey@gmail.com> | 2017-12-14 19:03:28 -0800 |
---|---|---|
committer | Jeffrey Guenther <guenther.jeffrey@gmail.com> | 2017-12-14 19:03:28 -0800 |
commit | 1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc (patch) | |
tree | ea060a71e57ec1e6366a33f7e40be14ea2f0d64b /activestorage/app/models | |
parent | ab2a95db8088b7607017671b82e396bcd9e80332 (diff) | |
parent | cc0d272c8c37c197a7e68633e5f082eccb2e3737 (diff) | |
download | rails-1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc.tar.gz rails-1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc.tar.bz2 rails-1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc.zip |
Merge branch 'master' into activestorage-guide
Diffstat (limited to 'activestorage/app/models')
3 files changed, 9 insertions, 7 deletions
diff --git a/activestorage/app/models/active_storage/filename.rb b/activestorage/app/models/active_storage/filename.rb index 79d55dc889..b9413dec95 100644 --- a/activestorage/app/models/active_storage/filename.rb +++ b/activestorage/app/models/active_storage/filename.rb @@ -50,7 +50,7 @@ class ActiveStorage::Filename @filename.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "�").strip.tr("\u{202E}%$|:;/\t\r\n\\", "-") end - def parameters + def parameters #:nodoc: Parameters.new self end diff --git a/activestorage/app/models/active_storage/filename/parameters.rb b/activestorage/app/models/active_storage/filename/parameters.rb index 58ce198d38..fb9ea10e49 100644 --- a/activestorage/app/models/active_storage/filename/parameters.rb +++ b/activestorage/app/models/active_storage/filename/parameters.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ActiveStorage::Filename::Parameters +class ActiveStorage::Filename::Parameters #:nodoc: attr_reader :filename def initialize(filename) diff --git a/activestorage/app/models/active_storage/variation.rb b/activestorage/app/models/active_storage/variation.rb index 13bad87cac..fc4305dcc5 100644 --- a/activestorage/app/models/active_storage/variation.rb +++ b/activestorage/app/models/active_storage/variation.rb @@ -46,11 +46,13 @@ class ActiveStorage::Variation # Accepts an open MiniMagick image instance, like what's returned by <tt>MiniMagick::Image.read(io)</tt>, # and performs the +transformations+ against it. The transformed image instance is then returned. def transform(image) - transformations.each do |(method, argument)| - if eligible_argument?(argument) - image.public_send(method, argument) - else - image.public_send(method) + transformations.each do |method, argument| + image.mogrify do |command| + if eligible_argument?(argument) + command.public_send(method, argument) + else + command.public_send(method) + end end end end |