Method: Figgy::Configuration#initialize

Defined in:
lib/figgy/configuration.rb

#initializeConfiguration

Constructs a new Figgy::Configuration instance.

By default, uses a root of the current directory, and defines handlers for .yml, .yaml, .yml.erb, .yaml.erb, and .json.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/figgy/configuration.rb', line 23

def initialize
  @roots    = [Dir.pwd]
  @handlers = []
  @overlays = []
  @always_reload = false
  @preload = false
  @freeze = false

  define_handler 'yml', 'yaml' do |contents|
    YAML.load(contents)
  end

  define_handler 'yml.erb', 'yaml.erb' do |contents|
    erb = ERB.new(contents).result
    YAML.load(erb)
  end

  define_handler 'json' do |contents|
    JSON.parse(contents)
  end
end