Sha256: 6c33762024d773c7f723934098e6ea3918ca47b34422fdae92181181c1126069
Contents?: true
Size: 1.66 KB
Versions: 39
Compression:
Stored size: 1.66 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.keys.map(&:to_s).sort.each { |k| blk.call(k, @configurators[k.to_sym]) } true end protected # Initialize configurators hash def initialize @configurators = Hash.new end end end
Version data entries
39 entries across 39 versions & 1 rubygems