Skip to content

configure: Why not just `yield` instead of `yield self`? #545

Closed
mattdipasquale opened this Issue Jul 1, 2012 · 3 comments

3 participants

@mattdipasquale

In all examples I've seen, the block passed to Base#configure doesn't take any arguments. Why pass self as an argument?

https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L1374

@canton7
canton7 commented Jul 1, 2012

See http://www.sinatrarb.com/intro#Application/Class%20Scope, in particular the second to last line.

@mattdipasquale

Hmm... But, wouldn't self inside the block passed to configure { |c| ... } be equal to c? If not, what is self inside that block?

Perhaps an example would help me understand when it makes sense to pass a block with an argument to configure.

@rkh
Sinatra member
rkh commented Aug 31, 2012

No, only in modular apps, in classic apps some methods are just delegated. I agree that there is hardly a use case now, but it would break old apps (register used to not be delegated).

@rkh rkh closed this Aug 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.