Module: Configuration
- Included in:
- Afasgem
- Defined in:
- lib/afasgem/configuration.rb
Overview
Provides module configuration # Source: viget.com/extend/easy-gem-configuration-variables-with-defaults
Instance Method Summary collapse
Instance Method Details
#configuration {|_self| ... } ⇒ Object
4 5 6 |
# File 'lib/afasgem/configuration.rb', line 4 def configuration yield self end |
#define_setting(name, default = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/afasgem/configuration.rb', line 8 def define_setting(name, default = nil) class_variable_set("@@#{name}", default) define_class_method "#{name}=" do |value| class_variable_set("@@#{name}", value) end define_class_method name do class_variable_get("@@#{name}") end end |