Module: SimpleConfigurable
- Defined in:
- lib/simple_configurable.rb,
lib/simple_configurable/version.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
Class Method Details
.with(*attrs) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/simple_configurable.rb', line 4 def self.with(*attrs) configuration_class = Class.new do attr_accessor *attrs end class_methods = Module.new do define_method :config do @config ||= configuration_class.new end def configure yield config end end Module.new do singleton_class.send :define_method, :included do |base| base.extend class_methods end end end |