Module: Dependor::Sinatra::BlockWrapper

Defined in:
lib/dependor-sinatra/block_wrapper.rb

Class Method Summary collapse

Class Method Details

.wrap(block) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/dependor-sinatra/block_wrapper.rb', line 4

def self.wrap(block)
  proc do
    dependency_names = block.parameters.map(&:last)
    dependencies = dependency_names.map{|name| injector.__send__(name)}
    instance_exec(*dependencies, &block)
  end
end