module Cogwheels::Loader

This module helps in loading YAML configurations from different source types

Public Class Methods

from_file(file) click to toggle source
# File lib/cogwheels/loader.rb, line 14
def from_file(file)
  hash = {}
  if File.exist?(file)
    yaml = IO.read(file)
    hash = safe_load(yaml, File.path(file))
  end
  hash
end
load(src, mutable = true) click to toggle source
# File lib/cogwheels/loader.rb, line 10
def load(src, mutable = true)
  return Configuration.new(from_file(src), mutable) if File.file?(src)
end

Private Class Methods

safe_load(yaml, name) click to toggle source
# File lib/cogwheels/loader.rb, line 25
def safe_load(yaml, name)
  SafeYAML.load(yaml, name)
end