Module: Foreman::Export

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

Defined Under Namespace

Classes: Base, Bluepill, Exception, Inittab, Runit, Supervisord, Upstart

Class Method Summary collapse

Methods included from Helpers

classify, constantize

Class Method Details

.error(message) ⇒ Object



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

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

.formatter(format) ⇒ Object



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

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