Sha256: 49107924fb3999d106fb73f41a0f08926171fbb2108b143f1d5d2bab4875381a

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

module RockConfig
  class Manager
    def initialize(configuration, scanner = Scanner)
      @scanner = scanner.new(configuration)
      @configs = initialize_configs
    end

    def fetch(config_name, environment)
      if config = @configs[config_name]
        config.send environment
      end
    end

    def initialize_configs
      Hash.new do |hash, key|
        if config = @scanner.find(key)
          hash[key] = config
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rock_config-0.0.1 lib/rock_config/manager.rb