Sha256: eddb24e9bfdae6a97828977e4f1d77ee033eeca90dfb905342dcfdd9fd863196
Contents?: true
Size: 746 Bytes
Versions: 22
Compression:
Stored size: 746 Bytes
Contents
# Toplevel Pubnub module. module Pubnub # SubscribeCallback class holds infrastructure for subscribe callbacks class SubscribeCallback attr_accessor :callbacks def initialize(options) @callbacks = { message: options[:message], status: options[:status], presence: options[:presence], signal: options[:signal], object: options[:object] } validate! end private def validate! # Check if each callback responds to call and accept one parameter. @callbacks.each do |type, callback| raise "#{type} callback is not valid in SubscribeCallback." unless (callback.respond_to?(:call) && callback.arity == 1) || callback.nil? end end end end
Version data entries
22 entries across 22 versions & 1 rubygems