Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better file/line detection in sinatra_warn

  • Loading branch information...
commit 4cddd7054123cebac7d9bc58b7187a0acbccded8 1 parent 17cb177
@rtomayko rtomayko authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/sinatra/compat.rb
View
4 lib/sinatra/compat.rb
@@ -10,7 +10,9 @@
# Like Kernel#warn but outputs the location that triggered the warning.
def sinatra_warn(*message)
- line = caller[1].sub(/:in .*/, '')
+ line = caller.
+ detect { |line| line !~ /(?:lib\/sinatra\/|__DELEGATE__)/ }.
+ sub(/:in .*/, '')
warn "#{line}: warning: #{message.join(' ')}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.