Permalink
Browse files

sinatra 0.9 is no longer supported

  • Loading branch information...
1 parent ad8d870 commit 0ee132326a7d8cee31888f2273cb4fa79f6d4b5c @rkh committed May 2, 2010
Showing with 1 addition and 10 deletions.
  1. +0 −4 README.md
  2. +1 −6 lib/sinatra/sugar.rb
View
4 README.md
@@ -26,10 +26,6 @@ More advanced set
set :haml, :format => :html5, :escape_html => true
set :haml, :excape_html => false
haml # => { :format => :html5, :escape_html => false }
-
-- Allows passing a block in Sinatra 0.9, too:
-
- set(:foo) { Time.now }
More advanced register
----------------------
View
7 lib/sinatra/sugar.rb
@@ -37,15 +37,10 @@ module ClassMethods
# - Allowes passing a block (for Sinatra 0.9.x):
# set(:foo) { Time.now }
def set(key, value = self, &block)
- # FIXME: refactor, refactor, refactor
- if block_given? and Sinatra::VERSION < "1.0"
- raise ArgumentError, "both a value and a block given" if value != self
- value = block
- end
symbolized = (key.to_sym if key.respond_to? :to_sym)
old_value = (send(symbolized) if symbolized and respond_to? symbolized)
value = old_value.merge value if value.is_a? Hash and old_value.is_a? Hash
- super(key, value)
+ super
# HACK: Sinatra::Base.set uses recursion and in the final step value always
# is a Proc. Also, if value is a Proc no step ever follows. I abuse this to
# invoke the hooks only once per set.

0 comments on commit 0ee1323

Please sign in to comment.