#tap_if - a new type of conditional for Ruby
1–3 of 3 posts
Re: #tap_if - a new type of conditional for Ruby
#2Instead of assigning a variable or bloating the length of your statements, use this method to to return the caller and only execute the block if the condition passes.
User.where(:email => email).first.tap_if(:present?) {|user| user.send_update }
Re: #tap_if - a new type of conditional for Ruby
#3the magic is here: https://github.com/bnorton/tap_if/blob/master/lib/tap_if.rb