diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-07-22 17:12:51 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-07-22 17:12:51 +0200 |
commit | 34a7b50fb278fc37c937f2fe170b86332eb054c5 (patch) | |
tree | e1debcb36000764b5c7e69e0f2d7e5b92fcb9833 /lib/overwrite.rb | |
parent | 05084b1127f0d2498240472cca8a475f48f1fcc4 (diff) |
CONFIG reverted to @@config
Diffstat (limited to 'lib/overwrite.rb')
-rw-r--r-- | lib/overwrite.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/overwrite.rb b/lib/overwrite.rb new file mode 100644 index 0000000..1d0161b --- /dev/null +++ b/lib/overwrite.rb @@ -0,0 +1,14 @@ +# class overwrites aka monkey patches +# hack: store sinatra in global var to make url_for and halt methods accessible +before{ $sinatra = self unless $sinatra } + +class Sinatra::Base + # overwriting halt to log halts (!= 202) + def halt(*response) + LOGGER.error "halt "+response.first.to_s+" "+(response.size>1 ? response[1].to_s : "") if response and response.first and response.first >= 300 + # orig sinatra code: + response = response.first if response.length == 1 + throw :halt, response + end +end + |