Sha256: a8ed17e6ddab3a6aaacd0d9c0cb98ac77391b0a4890449d0899dd86e2894ead2

Contents?: true

Size: 609 Bytes

Versions: 19

Compression:

Stored size: 609 Bytes

Contents

module Pubnub
  module Validator

    def valid_channel?(allow_array = true)
      valid = true
      if @channel.is_a? Array
        if allow_array
          @channel.each do |channel|
            unless channel.is_a?(String) || channel.is_a?(Symbol)
              valid = false
              break
            end
          end
        else
          valid = false
        end
      else
        if !@channel.is_a?(String) && !@channel.is_a?(Symbol)
          valid = false
        elsif @channel.to_s.index(',') && !allow_array
          valid = false
        end
      end

      valid

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pubnub-3.7.12 lib/pubnub/validator.rb
pubnub-3.7.11 lib/pubnub/validator.rb
pubnub-3.7.10 lib/pubnub/validator.rb
pubnub-3.7.9 lib/pubnub/validator.rb
pubnub-3.7.7 lib/pubnub/validator.rb
pubnub-3.7.5 lib/pubnub/validator.rb
pubnub-3.7.1 lib/pubnub/validator.rb
pubnub-3.7.0 lib/pubnub/validator.rb
pubnub-3.6.10 lib/pubnub/validator.rb
pubnub-3.6.9 lib/pubnub/validator.rb
pubnub-3.6.7 lib/pubnub/validator.rb
pubnub-3.5.14 lib/pubnub/validator.rb
pubnub-3.5.12 lib/pubnub/validator.rb
pubnub-3.5.8 lib/pubnub/validator.rb
pubnub-3.5.7 lib/pubnub/validator.rb
pubnub-3.5.6 lib/pubnub/validator.rb
pubnub-3.5.5 lib/pubnub/validator.rb
pubnub-3.5.3 lib/pubnub/validator.rb
pubnub-3.5.1 lib/pubnub/validator.rb