Sha256: 6ee67b83617c01fc2fc15e1419d95133f46ea88b4790c2cd16eb760112411a56

Contents?: true

Size: 565 Bytes

Versions: 7

Compression:

Stored size: 565 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

    def self.check
      $stdout.puts(@data.inspect)
      $stdout.puts("OK")
    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

7 entries across 7 versions & 1 rubygems

Version Path
containers_manager-0.1.13 lib/containers_manager/configuration.rb
containers_manager-0.1.12 lib/containers_manager/configuration.rb
containers_manager-0.1.11 lib/containers_manager/configuration.rb
containers_manager-0.1.10 lib/containers_manager/configuration.rb
containers_manager-0.1.9 lib/containers_manager/configuration.rb
containers_manager-0.1.8 lib/containers_manager/configuration.rb
containers_manager-0.1.7 lib/containers_manager/configuration.rb