Project

tapenade

0.0
Low commit activity in last 3 years
No release in over a year
Improved tap method
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Tapenade

Tapenade allows to chain method after tap instead of using a block.

Examples

# With Ruby's tap
User.find(param[:id]).tap { |user| user.update!(user_params) }
# => returns the user

# With Tapenade:
User.find(param[:id]).tap.update!(user_params)
# => returns the user

Examples are using Rails models but it works with any method on any object.

You can of course still use tap with blocks as usual.

Installation

Add this line to your application's Gemfile:

gem "tapenade"

That's all.

License

The gem is available as open source under the terms of the MIT License.