Class: Delayed::Master::Database
- Inherits:
-
Object
- Object
- Delayed::Master::Database
- Defined in:
- lib/delayed/master/database.rb
Instance Attribute Summary collapse
-
#spec_name ⇒ Object
Returns the value of attribute spec_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(spec_name) ⇒ Database
constructor
A new instance of Database.
- #model ⇒ Object
- #with_connection ⇒ Object
Constructor Details
#initialize(spec_name) ⇒ Database
Returns a new instance of Database.
11 12 13 |
# File 'lib/delayed/master/database.rb', line 11 def initialize(spec_name) @spec_name = spec_name end |
Instance Attribute Details
#spec_name ⇒ Object
Returns the value of attribute spec_name.
9 10 11 |
# File 'lib/delayed/master/database.rb', line 9 def spec_name @spec_name end |
Class Method Details
.all(spec_names = nil) ⇒ Object
44 45 46 47 |
# File 'lib/delayed/master/database.rb', line 44 def all(spec_names = nil) spec_names = spec_names.presence || spec_names_with_delayed_job_table spec_names.map { |spec_name| new(spec_name) } end |
Instance Method Details
#model ⇒ Object
15 16 17 18 19 |
# File 'lib/delayed/master/database.rb', line 15 def model cache_model do define_model end end |
#with_connection ⇒ Object
21 22 23 24 25 |
# File 'lib/delayed/master/database.rb', line 21 def with_connection model.connection_pool.with_connection do |connection| yield connection end end |