Module: Wrest::AsyncRequest

Defined in:
lib/wrest/async_request.rb,
lib/wrest/async_request/thread_backend.rb,
lib/wrest/async_request/event_machine_backend.rb

Defined Under Namespace

Classes: EventMachineBackend, ThreadBackend

Class Method Summary (collapse)

Class Method Details

+ (Object) default_backend

Returns the default backend



35
36
37
# File 'lib/wrest/async_request.rb', line 35

def self.default_backend
  @default_backend
end

+ (Object) default_backend=(backend)

Assign default backend to be used for asynchronous request. Default is to use threads



19
20
21
# File 'lib/wrest/async_request.rb', line 19

def self.default_backend=(backend)
  @default_backend = backend
end

+ (Object) default_to_em!

Assign default backend for asynchronous request to using eventmachine.



24
25
26
27
# File 'lib/wrest/async_request.rb', line 24

def self.default_to_em!
  self.enable_em
  self.default_backend = Wrest::AsyncRequest::EventMachineBackend.new
end

+ (Object) default_to_threads!

Assign default backend for asynchronous request to using threads.



30
31
32
# File 'lib/wrest/async_request.rb', line 30

def self.default_to_threads!
  self.default_backend = Wrest::AsyncRequest::ThreadBackend.new
end

+ (Object) enable_em

Loads Wrest eventmachine backend alongwith eventmachine gem



14
15
16
# File 'lib/wrest/async_request.rb', line 14

def self.enable_em
  require "#{Wrest::Root}/wrest/async_request/event_machine_backend"
end