Module: Anisoptera::Endpoint

Included in:
AsyncEndpoint, SyncEndpoint
Defined in:
lib/anisoptera/endpoint.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.factory(config, block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/anisoptera/endpoint.rb', line 5

def self.factory(config, block)
  if defined?(EventMachine) && Anisoptera.prefer_async
    require 'anisoptera/async_endpoint'
    AsyncEndpoint.new(config, &block)
  else
    require 'anisoptera/sync_endpoint'
    SyncEndpoint.new(config, &block)
  end
  
end

Instance Method Details

#initialize(config, &block) ⇒ Object



16
17
18
19
# File 'lib/anisoptera/endpoint.rb', line 16

def initialize(config, &block)
  @config = config
  @handler = block
end