Sha256: 099a6f9df3eb638b9dbd9a3235880b23aeef8660deb13104b9903e90851035ff
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
module Slack module RealTime module Config class NoConcurrencyError < StandardError; end extend self ATTRIBUTES = [ :token, :websocket_ping, :websocket_proxy, :concurrency, :start_options ] attr_accessor(*Config::ATTRIBUTES) def reset self.websocket_ping = 30 self.websocket_proxy = nil self.token = nil self.concurrency = method(:detect_concurrency) self.start_options = {} end def concurrency (val = @concurrency).respond_to?(:call) ? val.call : val end private def detect_concurrency [:Eventmachine, :Celluloid].each do |concurrency| begin return Slack::RealTime::Concurrency.const_get(concurrency) rescue LoadError, NameError false # could not be loaded, missing dependencies end end fail NoConcurrencyError, 'Missing concurrency. Add faye-websocket or celluloid-io to your Gemfile.' end end class << self def configure block_given? ? yield(Config) : Config end def config Config end end end end Slack::RealTime::Config.reset
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slack-ruby-client-0.6.0 | lib/slack/real_time/config.rb |