Sha256: ec4317598085486f93a1c3e1d584b5ec19ddaecbba191208d31a1224de1451f1

Contents?: true

Size: 693 Bytes

Versions: 7

Compression:

Stored size: 693 Bytes

Contents

# Toplevel Pubnub module.
module Pubnub
  # Validator module that holds all validators modules
  module Validator
    # Validator for State event
    module State
      include CommonValidator

      def validate!
        return if @skip_validate
        validate_channel_and_uuid!
      end

      private

      def validate_channel_and_uuid!
        fail(
          ArgumentError.new(
            object: self,
            message: 'You have to specify single :channel or :uuid for State event.'
          ),
          'You have to specify single :channel or :uuid for State event.'
        ) if @channel.size == 0 && @uuid_looking_for.nil? || @channel.size > 1
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pubnub-3.8.5 lib/pubnub/validators/state.rb
pubnub-3.8.4 lib/pubnub/validators/state.rb
pubnub-3.8.2 lib/pubnub/validators/state.rb
pubnub-4.0.0beta2 lib/pubnub/validators/state.rb
pubnub-4.0.0beta1 lib/pubnub/validators/state.rb
pubnub-3.8.1 lib/pubnub/validators/state.rb
pubnub-3.8.0 lib/pubnub/validators/state.rb