Module: What::Formatters

Defined in:
lib/what/formatters.rb

Defined Under Namespace

Classes: Base, JSON, YAML

Class Method Summary collapse

Class Method Details

.load_allObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/what/formatters.rb', line 3

def self.load_all
  # load all formatters defined in what/formatters, in addition to any paths
  # specified in the config file.
  require 'what/formatters/base'

  globs = [File.join(File.dirname(__FILE__), 'formatters', '*.rb')]

  if Config['formatter_paths']
    Config['formatter_paths'].each do |formatter_path|
      globs << File.join(Config['base'], formatter_path, '*.rb')
    end
  end

  globs.each do |glob|
    Dir[glob].each do |fn|
      require fn
    end
  end

  Formatter.use(Config['formatter'])
end