Module: Pubby

Defined in:
lib/pubby.rb

Defined Under Namespace

Classes: Pubnub, SimpleAsync, Stub

Class Method Summary collapse

Class Method Details

.from_config(config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pubby.rb', line 7

def self.from_config(config)
  type = config.fetch('type') { raise "type is required" }
  
  klass = case type
          when 'stub'
            Pubby::Stub
          when 'pubnub'
            Pubby::Pubnub
          else
            raise "unknown type #{type.inspect}"
          end
          
  klass.from_config(config)
end