Sha256: 8a13732e02b7831f2e4e010034cad5aefa89bb6a511ead966b5adecb63b24d26

Contents?: true

Size: 358 Bytes

Versions: 1

Compression:

Stored size: 358 Bytes

Contents

module Reactor::Subscribable
  extend ActiveSupport::Concern

  module ClassMethods
    def on_event(event, method = nil, &block)
      callback = case method
        when Symbol
          {self => method}
        else
          method
      end
      callback = block if block
      (Reactor::SUBSCRIBERS[event.to_s] ||= []).push(callback)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reactor-0.3.2 lib/reactor/models/concerns/subscribable.rb