Class: Bashly::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bashly/config.rb

Overview

A convenience class to use either a hash or a filename as a configuration source.

When a filename is provided, it is loaded with these extra features:

  • Support for ‘import` keyword to merge additional YAML files

  • Preprocessing with ERB

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/bashly/config.rb', line 11

def config
  @config
end

Class Method Details

.new(config) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/bashly/config.rb', line 13

def self.new(config)
  if config.is_a? String
    YAML.load_erb_file(config).compose
  else
    config
  end
end