Class: Resque::Pool::FileOrHashLoader

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

Instance Method Summary collapse

Constructor Details

#initialize(filename_or_hash = nil) ⇒ FileOrHashLoader

Returns a new instance of FileOrHashLoader.



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

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



15
16
17
# File 'lib/resque/pool/file_or_hash_loader.rb', line 15

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

#reset!Object



19
20
21
# File 'lib/resque/pool/file_or_hash_loader.rb', line 19

def reset!
  @config = nil
end