We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This is a neat gem. I especially like how you can pull in just the modules you want.
According to the docs, ergo is like tap. But this example in nil deviates from tap's behavior:
ergo
tap
nil
nil.ergo{ |o| o.bar } #=> nil
Whereas with tap:
2.2.4 :024 > { value: nil }.tap { |o| o[:value] = o[:value].bar } NoMethodError: undefined method `bar' for nil:NilClass from (irb):24:in `block in irb_binding' from (irb):24:in `tap' from (irb):24 from /Users/benatkin/.rvm/rubies/ruby-2.2.4/bin/irb:11:in `<main>' 2.2.4 :025 >
Perhaps mention this in the docs, and consider changing it in a future release? This could be surprising behavior.
The text was updated successfully, but these errors were encountered:
Try { value: nil }.ergo { |o| o[:value] = o[:value].bar } and check the same result.
{ value: nil }.ergo { |o| o[:value] = o[:value].bar }
Sorry, something went wrong.
No branches or pull requests
This is a neat gem. I especially like how you can pull in just the modules you want.
According to the docs,
ergo
is liketap
. But this example innil
deviates from tap's behavior:Whereas with tap:
Perhaps mention this in the docs, and consider changing it in a future release? This could be surprising behavior.
The text was updated successfully, but these errors were encountered: