Module: Foreman::Export

Extended by:
Helpers
Defined in:
lib/foreman/export.rb

Defined Under Namespace

Classes: Base, Bluepill, Daemon, Exception, Inittab, Launchd, Runit, Supervisord, Systemd, Upstart

Class Method Summary collapse

Methods included from Helpers

classify, constantize

Class Method Details

.error(message) ⇒ Object


22
23
24
# File 'lib/foreman/export.rb', line 22

def self.error(message)
  raise Foreman::Export::Exception.new(message)
end

.formatter(format) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/foreman/export.rb', line 10

def self.formatter(format)
  begin
    require "foreman/export/#{ format.tr('-', '_') }"
    classy_format = classify(format)
    formatter     = constantize("Foreman::Export::#{ classy_format }")
  rescue NameError => ex
    error "Unknown export format: #{format} (no class Foreman::Export::#{ classy_format })."
  rescue LoadError => ex
    error "Unknown export format: #{format} (unable to load file 'foreman/export/#{ format.tr('-', '_') }')."
  end
end