Sha256: 3d2f17e4c58948765ddb7e16da947fe9dfc64cfb3205e6ba395863bf9ff682f6

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

require 'yaml'

module Dockage
  class Settings
    class << self
      def load(config_path = 'dockage.yml')
        raise DockageConfigNotFound unless File.exist? config_path
        deep_symbolize_keys(YAML.load_file(config_path))
      end

      private

      def deep_symbolize_keys(object)
        case object
        when Array
          object.map{ |v| deep_symbolize_keys(v) }
        when Hash
          result = {}
          object.each { |k,v| result[k.to_sym] = deep_symbolize_keys(v) }
          result
        else
          object
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dockage-0.1.3 lib/dockage/settings.rb
dockage-0.1.2 lib/dockage/settings.rb
dockage-0.1.1 lib/dockage/settings.rb
dockage-0.1.0 lib/dockage/settings.rb