Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

restore 1.8.6 compatibility

  • Loading branch information...
commit c56261996d2ef65d79395457f4967d0f9a53dfa4 1 parent ab2a2ed
@rkh rkh authored
Showing with 10 additions and 4 deletions.
  1. +4 −0 CHANGES
  2. +5 −3 lib/sinatra/base.rb
  3. +1 −1  sinatra.gemspec
View
4 CHANGES
@@ -1,3 +1,7 @@
+= 1.2.5 / 2011-04-30
+
+ * Restore compatibility with Ruby 1.8.6. (Konstantin Haase)
+
= 1.2.4 / 2011-04-30
* Sinatra::Application (classic style) does not use a session secret in
View
8 lib/sinatra/base.rb
@@ -7,7 +7,7 @@
require 'tilt'
module Sinatra
- VERSION = '1.2.4'
+ VERSION = '1.2.5'
# The request object. See Rack::Request for more info:
# http://rack.rubyforge.org/doc/classes/Rack/Request.html
@@ -59,7 +59,7 @@ def path_info=(value)
def accept_entry(entry)
type, *options = entry.gsub(/\s/, '').split(';')
quality = 0 # we sort smalles first
- options.delete_if { |e| quality = 1 - e[2..-1].to_f if e.start_with? 'q=' }
+ options.delete_if { |e| quality = 1 - e[2..-1].to_f if e =~ /^q=/ }
[type, [quality, type.count('*'), 1 - options.size]]
end
end
@@ -1467,7 +1467,9 @@ def self.register(*extensions, &block) #:nodoc:
module Delegator #:nodoc:
def self.delegate(*methods)
methods.each do |method_name|
- define_method(method_name) do |*args, &block|
+ define_method(method_name) do |*args|
+ # On Ruby 1.8.6, blocks cannot take block arguments directly.
+ block = Proc.new if block_given?
return super(*args, &block) if respond_to? method_name
::Sinatra::Application.send(method_name, *args, &block)
end
View
2  sinatra.gemspec
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.name = 'sinatra'
- s.version = '1.2.4'
+ s.version = '1.2.5'
s.date = '2011-04-30'
s.description = "Classy web-development dressed in a DSL"
Please sign in to comment.
Something went wrong with that request. Please try again.