These are chat archives for krisleech/wisper

13th
Feb 2015
Ryan Platte
@replaid
Feb 13 2015 16:59
This message was deleted
Ryan Platte
@replaid
Feb 13 2015 17:14
I'm using wisper-activerecord and have decided to ship semantic events for all situations relevant to listeners. So wisper-activerecord 0.3.0 sends out a :<model_name>_committed event that I want to transform into a :<model_name>_captured when #captured? goes from false to true. Since this is knowledge about the AR itself it seems a bit over the top to set up a separate listener just for this purpose, so I'm wanting to subscribe an AR to itself and ship the new event directly from a#<model_name>_committed method on the AR.
To do this was a after_initialize {|my_ar| my_ar.subscribe(my_ar) }, then a def <model_name>_committed(my_ar) that broadcasts the new event when appropriate. I'm either sharing an interesting usage of Wisper or soliciting feedback depending on whether folks here think this idea is sound or not. :-)