Sha256: 0b26f29f9626a4c7be8591837bb6fd2d2fc2ef3e28efc098527e93af55155dcd

Contents?: true

Size: 1.6 KB

Versions: 40

Compression:

Stored size: 1.6 KB

Contents

# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
#
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
# reproduction, modification, or disclosure of this program is
# strictly prohibited. Any use of this program by an authorized
# licensee is strictly subject to the terms and conditions,
# including confidentiality obligations, set forth in the applicable
# License Agreement between RightScale.com, Inc. and
# the licensee

module RightConf

  # Configurator mixin, defines DSL and common validation method
  class ConfiguratorRegistry

    include Singleton

    # Associate configurator with given key
    #
    # === Parameters
    # key(Symbol):: Key configurator should be associated with
    # value(Class):: Associated configurator class
    #
    # === Return
    # value(Class):: Configurator class
    def []=(key, value)
      @configurators[key] = value
    end

    # Configurator class for given key
    #
    # === Parameters
    # key(String):: Configurator for given key
    #
    # === Return
    # cfg_class(Constant):: Configurator class if there is one
    # nil:: Otherwise
    def [](key)
      @configurators[key]
    end

    # Iterate through all configurators
    #
    # === Block
    # Block should take one argument which is the configurator being iterated on
    #
    # === Return
    # true:: Always return true
    def each(&blk)
      @configurators.each(&blk)
      true
    end

    protected

    # Initialize configurators hash
    def initialize
      @configurators = Hash.new
    end

  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
rconf-0.7.6 lib/rconf/configurator_registry.rb
rconf-0.7.5 lib/rconf/configurator_registry.rb
rconf-0.7.4 lib/rconf/configurator_registry.rb
rconf-0.7.3 lib/rconf/configurator_registry.rb
rconf-0.7.2 lib/rconf/configurator_registry.rb
rconf-0.7.1 lib/rconf/configurator_registry.rb
rconf-0.7.0 lib/rconf/configurator_registry.rb
rconf-0.6.35 lib/rconf/configurator_registry.rb
rconf-0.6.34 lib/rconf/configurator_registry.rb
rconf-0.6.33 lib/rconf/configurator_registry.rb
rconf-0.6.32 lib/rconf/configurator_registry.rb
rconf-0.6.31 lib/rconf/configurator_registry.rb
rconf-0.6.30 lib/rconf/configurator_registry.rb
rconf-0.6.25 lib/rconf/configurator_registry.rb
rconf-0.6.24 lib/rconf/configurator_registry.rb
rconf-0.6.23 lib/rconf/configurator_registry.rb
rconf-0.6.22 lib/rconf/configurator_registry.rb
rconf-0.6.21 lib/rconf/configurator_registry.rb
rconf-0.6.20 lib/rconf/configurator_registry.rb
rconf-0.6.19 lib/rconf/configurator_registry.rb