Sha256: 43e559fff242fe016c13be27a846e9e7afc652e8d53d66c1bba8279cf95e4cb7
Contents?: true
Size: 674 Bytes
Versions: 1
Compression:
Stored size: 674 Bytes
Contents
module ClassConfig VERSION = '0.0.1' alias_method :configure, :tap def attr_config(name, default_value=nil) configuration_defaults[name.to_sym] = default_value define_singleton_method name do configuration[name.to_sym] end define_singleton_method "#{name}=" do |value| configuration_values[name.to_sym] = value end end def configuration configuration_defaults.merge configuration_values end def restore_default_configuration configuration_values.clear end private def configuration_defaults @configuration_defaults ||= {} end def configuration_values @configuration_values ||= {} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
class_config-0.0.1 | lib/class_config.rb |