Skip to content
Browse files

use settings instead of self.class

  • Loading branch information...
1 parent 82a7b8e commit f3adfb6c51b67260d0ee7b7cf0134625ba080315 @rkh rkh committed
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/sinatra/base.rb
View
10 lib/sinatra/base.rb
@@ -587,7 +587,7 @@ def compile_template(engine, data, options, views)
case
when data.is_a?(Symbol)
- body, path, line = self.class.templates[data]
+ body, path, line = settings.templates[data]
if body
body = body.call if body.respond_to?(:call)
template.new(path, line.to_i, options) { body }
@@ -605,7 +605,7 @@ def compile_template(engine, data, options, views)
end
when data.is_a?(Proc) || data.is_a?(String)
body = data.is_a?(String) ? Proc.new { data } : data
- path, line = self.class.caller_locations.first
+ path, line = settings.caller_locations.first
template.new(path, line.to_i, options, &body)
else
raise ArgumentError
@@ -710,13 +710,13 @@ def forward
private
# Run filters defined on the class and all superclasses.
- def filter!(type, base = self.class)
+ def filter!(type, base = settings)
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |block| instance_eval(&block) }
end
# Run routes defined on the class and all superclasses.
- def route!(base=self.class, pass_block=nil)
+ def route!(base = settings, pass_block=nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do
@@ -891,7 +891,7 @@ def handle_exception!(boom)
# Find an custom error block for the key(s) specified.
def error_block!(*keys)
keys.each do |key|
- base = self.class
+ base = settings
while base.respond_to?(:errors)
if block = base.errors[key]
# found a handler, eval and return result

0 comments on commit f3adfb6

Please sign in to comment.
Something went wrong with that request. Please try again.