Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dont need the explicit error handling -- if the require fails, it wil…
…l raise exactly the error we want to communicate anyway. Also use the load path, so we can allow plugins, rather than requre_relative
  • Loading branch information
dhh committed May 19, 2014
1 parent d7c3098 commit fd1e61a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
16 changes: 2 additions & 14 deletions lib/active_job/base.rb
@@ -1,9 +1,7 @@
require 'active_job/errors'
require 'active_job/queue_adapters/inline_adapter'
require 'active_support/core_ext/string/inflections'

module ActiveJob

class Base
cattr_accessor(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter }
cattr_accessor(:queue_base_name) { "active_jobs" }
Expand All @@ -19,19 +17,9 @@ def queue_as(part_name)
end

def adapter=(adapter_name)
adapter_name = adapter_name.to_s
unless %w(inline resque sidekiq sucker_punch).include?(adapter_name)
fail ActiveJob::NotImplementedError
end

begin
require_relative "queue_adapters/#{adapter_name}_adapter"
ActiveJob::Base.queue_adapter = "ActiveJob::QueueAdapters::#{adapter_name.camelize}Adapter".constantize
rescue
fail ActiveJob::Error.new("#{adapter_name} is missing")
end
require "active_job/queue_adapters/#{adapter_name}_adapter"
ActiveJob::Base.queue_adapter = "ActiveJob::QueueAdapters::#{adapter_name.to_s.camelize}Adapter".constantize
end
end

end
end
12 changes: 0 additions & 12 deletions lib/active_job/errors.rb

This file was deleted.

0 comments on commit fd1e61a

Please sign in to comment.