Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :write option to manipulate!. Issue #711. #726

Merged
merged 1 commit into from May 3, 2012

Conversation

chopmo
Copy link
Contributor

@chopmo chopmo commented Apr 28, 2012

Options for the RMagick #write call can now be added to the options under the :write key. Since the #write call takes a block containing assignments, these options are translated to a lambda.

Also, the options argument is now yielded to the block, allowing it to be updated based on the image object (eg. change interlace option only if necessary).

Example:

manipulate! do |img, index, options|
  options[:write] = {
    :quality => 50,
    :depth => 8
  }
  img
end

is translated to

image.write do |img|
  self.quality = 50
  self.depth = 8
end

By the way I apologize for the ugly stubbing in the spec. I didn't see how else to test this without factoring out ::Magick from CW::RMagick.

@travisbot
Copy link

This pull request passes (merged 37cb9bc into 024f302).

trevorturk added a commit that referenced this pull request May 3, 2012
Add :write option to manipulate!. Issue #711.
@trevorturk trevorturk merged commit 905ab9e into carrierwaveuploader:master May 3, 2012
@trevorturk
Copy link
Contributor

Thanks, @chopmo! 🤘

@erichurst
Copy link
Contributor

I know this is old, but a 🍻 to @chopmo. This PR made my night! Thank you.

@chopmo
Copy link
Contributor Author

chopmo commented Sep 26, 2014

Great to hear @erichurst ! Glad you found it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants