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 Attribute Summary collapse
-
#allow_update ⇒ Object
readonly
Returns the value of attribute allow_update.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Server
constructor
A new instance of Server.
- #using_active_record? ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ Server
Returns a new instance of Server.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/delayed/server.rb', line 14 def initialize(*args) 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.fetch("DATABASE_URL", nil)) end @allow_update = args.length.positive? && args[0][:update] end |
Instance Attribute Details
#allow_update ⇒ Object (readonly)
Returns the value of attribute allow_update.
29 30 31 |
# File 'lib/delayed/server.rb', line 29 def allow_update @allow_update end |
Instance Method Details
#using_active_record? ⇒ Boolean
25 26 27 |
# File 'lib/delayed/server.rb', line 25 def using_active_record? Delayed::Job == Delayed::Backend::ActiveRecord::Job end |