module Plaintext::Configuration

Attributes

config[RW]

Public Class Methods

[](name) click to toggle source

Returns a configuration setting

# File lib/plaintext/configuration.rb, line 9
def [](name)
  load if self.config.nil?
  self.config[name]
end
load(config_file = nil) click to toggle source
# File lib/plaintext/configuration.rb, line 14
def load(config_file = nil)
  self.config = {}
  return unless config_file

  file_config = YAML::load(ERB.new(config_file).result)
  if file_config.is_a?(Hash)
    self.config = file_config
  else
    warn "`config_file` is not a valid Plaintext configuration file, ignoring."
  end
end