Sha256: 5cc915e85c0b368af414e54b3b5403655ab787c6cf729a3d020f1c7adeae59c5

Contents?: true

Size: 478 Bytes

Versions: 2

Compression:

Stored size: 478 Bytes

Contents

require 'yaml'

module ContainersManager
  class Configuration
    def self.load(file_path)
      raise "#{file_path} cannot be found" unless File.exists?(file_path)

      @file_path = file_path
      @data      = YAML.load_file(file_path)
    end

    private

    def self.method_missing(method_name, *args, &block)
      value = @data[method_name.to_s]
      raise "Attribute '#{method_name}' cannot be found in the #{@file_path}" unless value
      value
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
containers_manager-0.1.6 lib/containers_manager/configuration.rb
containers_manager-0.1.5 lib/containers_manager/configuration.rb