Permalink
Browse files

don't blow up if EM is not loaded

  • Loading branch information...
1 parent db7b094 commit da851efb64eb80ba3bf9e50e383a11ae59ee5f57 @technoweenie technoweenie committed Feb 13, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/faraday/adapter/em_synchrony.rb
@@ -1,9 +1,12 @@
-require 'em-synchrony/em-http'
-require 'fiber'
-
module Faraday
class Adapter
class EMSynchrony < Faraday::Adapter
+ begin
+ require 'em-synchrony/em-http'
+ require 'fiber'
+ rescue LoadError, NameError => e
+ self.load_error = e
+ end
class Header
include Net::HTTPHeader
@@ -21,9 +24,7 @@ def initialize response
def call(env)
process_body_for_request(env)
-
request = EventMachine::HttpRequest.new(URI::parse(env[:url].to_s))
-
options = {:head => env[:request_headers]}
if env[:body]

0 comments on commit da851ef

Please sign in to comment.