Sha256: cdd822c1ad16525b7ac32370633f47f0db66259041d61f80bf4dca9030901ab5

Contents?: true

Size: 421 Bytes

Versions: 12

Compression:

Stored size: 421 Bytes

Contents

require 'active_support/notifications'

class Peastash
  module Watch
    def watch(event, opts = {}, &block)
      event_group = opts[:event_group] || event
      ActiveSupport::Notifications.subscribe(event) do |*args|
        # Calling the processing block with the Notification args and the store
        block.call(*args, self.store[event_group])
      end
    end
  end
end

Peastash.send :include, Peastash::Watch

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
peastash-0.2.9 lib/peastash/rails_ext/watch.rb
peastash-0.2.7 lib/peastash/rails_ext/watch.rb
peastash-0.2.6 lib/peastash/rails_ext/watch.rb
peastash-0.2.5 lib/peastash/rails_ext/watch.rb
peastash-0.2.4 lib/peastash/rails_ext/watch.rb
peastash-0.2.3 lib/peastash/rails_ext/watch.rb
peastash-0.2.2 lib/peastash/rails_ext/watch.rb
peastash-0.2.1 lib/peastash/rails_ext/watch.rb
peastash-0.1.1 lib/peastash/rails_ext/watch.rb
peastash-0.1.0 lib/peastash/rails_ext/watch.rb
peastash-0.0.9 lib/peastash/rails_ext/watch.rb
peastash-0.0.8 lib/peastash/rails_ext/watch.rb