Class: Lhm::Throttler::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/lhm/throttler.rb

Class Method Summary collapse

Class Method Details

.create_throttler(type, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/lhm/throttler.rb', line 25

def self.create_throttler(type, options = {})
  case type
  when Lhm::Command
    type
  when Symbol
    CLASSES[type].new(options)
  when String
    CLASSES[type.to_sym].new(options)
  when Class
    type.new(options)
  else
    raise ArgumentError, 'type argument must be a Symbol, String or Class'
  end
end