Sha256: da963e566dc5ac2a1374ac3f38cdcb8cad87fa67cc06c261baaee1caf777ee25

Contents?: true

Size: 421 Bytes

Versions: 2

Compression:

Stored size: 421 Bytes

Contents

module Yaps
  module Subscriber
    extend ActiveSupport::Concern
    module ClassMethods
      def subscribe(event, opts)
        options = opts.clone
        Wisper.add_listener(subscribe_instance, on: event, with: options[:with])
        nil
      end

      def subscribe_instance
        @subscribe_instance ||= self.new
      end

      def available_options
        [:on, :with].freeze
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yaps-0.1.0 lib/yaps/subscriber.rb
yaps-0.0.2 lib/yaps/subscriber.rb