Class: Shoryuken::EnvironmentLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/shoryuken/environment_loader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ EnvironmentLoader

Returns a new instance of EnvironmentLoader.


16
17
18
# File 'lib/shoryuken/environment_loader.rb', line 16

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options


3
4
5
# File 'lib/shoryuken/environment_loader.rb', line 3

def options
  @options
end

Class Method Details

.load_for_rails_consoleObject


11
12
13
14
# File 'lib/shoryuken/environment_loader.rb', line 11

def self.load_for_rails_console
  instance = setup_options(config_file: (Rails.root + 'config' + 'shoryuken.yml'))
  instance.load
end

.setup_options(options) ⇒ Object


5
6
7
8
9
# File 'lib/shoryuken/environment_loader.rb', line 5

def self.setup_options(options)
  instance = new(options)
  instance.setup_options
  instance
end

Instance Method Details

#loadObject


25
26
27
28
29
30
31
32
# File 'lib/shoryuken/environment_loader.rb', line 25

def load
  load_rails if Shoryuken.options[:rails]
  prefix_active_job_queue_names
  parse_queues
  require_workers
  validate_queues
  validate_workers
end

#setup_optionsObject


20
21
22
23
# File 'lib/shoryuken/environment_loader.rb', line 20

def setup_options
  initialize_options
  initialize_logger
end