motion/reactor/eventable.rb in bubble-wrap-1.3.0.osx vs motion/reactor/eventable.rb in bubble-wrap-1.3.0

- old
+ new

@@ -5,30 +5,30 @@ # When `event` is triggered the block will execute # and be passed the arguments that are passed to # `trigger`. def on(event, &blk) - events[event].push blk + __events__[event].push blk end # When `event` is triggered, do not call the given # block any more def off(event, &blk) - events[event].delete_if { |b| b == blk } + __events__[event].delete_if { |b| b == blk } blk end # Trigger an event def trigger(event, *args) - events[event].map do |event| + __events__[event].map do |event| event.call(*args) end end private - def events - @events ||= Hash.new { |h,k| h[k] = [] } + def __events__ + @__events__ ||= Hash.new { |h,k| h[k] = [] } end end end end