Class: Resque::Pool::ConfigLoaders::FileOrHashLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/pool/config_loaders/file_or_hash_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename_or_hash = nil) ⇒ FileOrHashLoader

Returns a new instance of FileOrHashLoader.



6
7
8
9
10
11
12
13
14
15
# File 'lib/resque/pool/config_loaders/file_or_hash_loader.rb', line 6

def initialize(filename_or_hash=nil)
  case filename_or_hash
  when String, nil
    @filename = filename_or_hash
  when Hash
    @static_config = filename_or_hash.dup
  else
    raise "#{self.class} cannot be initialized with #{filename_or_hash.inspect}"
  end
end

Instance Method Details

#call(environment) ⇒ Object



17
18
19
# File 'lib/resque/pool/config_loaders/file_or_hash_loader.rb', line 17

def call(environment)
  @config ||= load_config_from_file(environment)
end

#reset!Object



21
22
23
# File 'lib/resque/pool/config_loaders/file_or_hash_loader.rb', line 21

def reset!
  @config = nil
end