Skip to content

Commit

Permalink
Support the latest version of rmagick
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Jan 17, 2021
1 parent 3d1259f commit 88f2445
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion carrierwave.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "fog-rackspace"
s.add_development_dependency "mini_magick", ">= 3.6.0"
if RUBY_ENGINE != 'jruby'
s.add_development_dependency "rmagick", "~> 2.16"
s.add_development_dependency "rmagick", ">= 2.16"
end
s.add_development_dependency "timecop"
s.add_development_dependency "generator_spec", ">= 0.9.1"
Expand Down
4 changes: 2 additions & 2 deletions lib/carrierwave/processing/rmagick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def resize_and_pad(width, height, background=:transparent, gravity=::Magick::Cen
height = dimension_from height
manipulate! do |img|
img.resize_to_fit!(width, height)
new_img = ::Magick::Image.new(width, height) { self.background_color = background == :transparent ? 'rgba(255,255,255,0)' : background.to_s }
new_img = ::Magick::Image.new(width, height) { |img| img.background_color = background == :transparent ? 'rgba(255,255,255,0)' : background.to_s }
if background == :transparent
filled = new_img.matte_floodfill(1, 1)
else
Expand Down Expand Up @@ -378,7 +378,7 @@ def manipulate!(options={}, &block)

def create_info_block(options)
return nil unless options
assignments = options.map { |k, v| "self.#{k} = #{v}" }
assignments = options.map { |k, v| "img.#{k} = #{v}" }
code = "lambda { |img| " + assignments.join(";") + "}"
eval code
end
Expand Down

0 comments on commit 88f2445

Please sign in to comment.