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