Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow block parameters

  • Loading branch information...
commit 9a8bf4c10b0219df5b5c85f555c06094d0d9a92f 1 parent a96d7bf
@JonRowe JonRowe authored
Showing with 7 additions and 2 deletions.
  1. +2 −2 lib/morphine.rb
  2. +5 −0 spec/morphine_spec.rb
View
4 lib/morphine.rb
@@ -11,8 +11,8 @@ def dependencies
module ClassMethods
def register(name, &block)
- define_method name do
- dependencies[name] ||= instance_eval(&block)
+ define_method name do |*args|
+ dependencies[name] ||= instance_exec(*args,&block)
end
define_method "#{name}=" do |service|
View
5 spec/morphine_spec.rb
@@ -31,5 +31,10 @@
container.client = 'new client'
container.client.should eq('new client')
end
+
+ it 'passes arguments through to the block' do
+ Container().register(:pass_through) { |argument| argument }
+ container.pass_through(:a).should == :a
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.