Class: Delayed::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Delayed::Server
- Defined in:
- lib/delayed/server.rb,
lib/delayed/server/helpers.rb
Defined Under Namespace
Modules: Helpers
Constant Summary collapse
- APP_DIR =
File.dirname(File.(__FILE__))
- DEFAULT_PAGE_SIZE =
10
- MAX_PAGE_SIZE =
100
Instance Method Summary collapse
- #allow_update ⇒ Object
-
#initialize(*args, &block) ⇒ Server
constructor
A new instance of Server.
- #using_active_record? ⇒ Boolean
Constructor Details
#initialize(*args, &block) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/delayed/server.rb', line 12 def initialize(*args, &block) super() # Rails will take care of establishing the DB connection for us if there is # an application present if using_active_record? && !ActiveRecord::Base.connected? ActiveRecord::Base.establish_connection(ENV['DATABASE_URL']) end @allow_update = args.length > 0 && args[0][:update] end |
Instance Method Details
#allow_update ⇒ Object
27 28 29 |
# File 'lib/delayed/server.rb', line 27 def allow_update @allow_update end |
#using_active_record? ⇒ Boolean
23 24 25 |
# File 'lib/delayed/server.rb', line 23 def using_active_record? Delayed::Job == Delayed::Backend::ActiveRecord::Job end |