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



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lhm/throttler.rb', line 16

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