diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index b9c1959d..bd9a4a51 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -679,7 +679,8 @@ module Sinatra # Sets an option to the given value. If the value is a proc, # the proc will be called every time the option is accessed. - def set(option, value=self) + def set(option, value=self, &block) + value = block if block if value.kind_of?(Proc) metadef(option, &value) metadef("#{option}?") { !!__send__(option) }