Sha256: d8b3f9fc7f8bd33cda668e5509433a125b4f00989280e1720c9bb0f0f18dc2d4
Contents?: true
Size: 1010 Bytes
Versions: 9
Compression:
Stored size: 1010 Bytes
Contents
require 'singleton' require 'sugar-high/kind_of' module CanTango class Configuration module Registry class Base attr_writer :default attr_accessor :registered def types= *types @types = types.select {|t| t.is_a?(Class) } end def types @types ||= [Symbol, String] @types end def clean! @registered = [] end alias_method :clear!, :clean! def default! @registered = default end def register *list registered << list.select_kinds_of(*types) @registered.flat_uniq! end alias_method :<<, :register def [] index registered[index] end def registered @registered ||= default end def registered? label registered.map(&:to_s).include? label.to_s end def default @default ||= [] end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems