Module: Itamae::Handler

Defined in:
lib/itamae/handler.rb,
lib/itamae/handler/base.rb,
lib/itamae/handler/json.rb,
lib/itamae/handler/debug.rb,
lib/itamae/handler/fluentd.rb

Defined Under Namespace

Classes: Base, Debug, Fluentd, Json

Class Method Summary collapse

Class Method Details

.from_type(type) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/itamae/handler.rb', line 5

def self.from_type(type)
  first_time = true

  class_name = type.split('_').map(&:capitalize).join
  self.const_get(class_name)
rescue NameError
  require "itamae/handler/#{type}"

  if first_time
    first_time = false
    retry
  else
    raise
  end
end