April 7th, 2015
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Ruby closures borderline macro syntax
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
A good reminder of how much block syntax gives you:
if user.save # publish event 'user.created', with payload {user: user} Publisher.broadcast_event('user.created', user: user) end def create_user(params) user = User.new(params) # publish event 'user.created', with payload {user: user}, using block syntax # now the event will have additional data about duration and exceptions Publisher.broadcast_event('user.created', user: user) do User.save! # do some more important stuff here end end
Post external references
- 1
http://alma-connect.github.io/techblog/2014/03/rails-pub-sub.html
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."