class Pharrell::Config
Public Class Methods
new(definition)
click to toggle source
# File lib/pharrell/config.rb, line 3 def initialize(definition) @definition = definition end
Public Instance Methods
extend(definition)
click to toggle source
# File lib/pharrell/config.rb, line 23 def extend(definition) agg_definition = proc { |binder| @definition.call(binder) definition.call(binder) } Config.new(agg_definition) end
instance_for(klass)
click to toggle source
# File lib/pharrell/config.rb, line 7 def instance_for(klass) binding = @bindings[klass] if binding binding.call(self) else raise BindingNotFoundError.new(klass) end end
rebuild!()
click to toggle source
# File lib/pharrell/config.rb, line 17 def rebuild! @bindings = Binder.new.tap { |b| @definition.call(b) }.bindings end