Permalink
Browse files

Small cleanup on oauth_ghostbuster's tolerance for non-twurl environm…

…ents.
  • Loading branch information...
1 parent a0de51c commit d94e812a19153cf04540bf3bb3f8ff234c7a2811 @episod committed Aug 3, 2010
Showing with 13 additions and 9 deletions.
  1. +13 −9 lib/twurl/oauth_ghostbuster.rb
View
22 lib/twurl/oauth_ghostbuster.rb
@@ -1,13 +1,21 @@
-# Trap a ghost!
+# Taylor Singletary did this. http://twitter.com/episod
+# This is reckless monkey patching that makes OAuth cough up the goods.
+
+
+# The GhostTrap is where the ghosts of OAuth past are stored.
class GhostTrap
@@log = []
@@trapper_keeper = {}
def GhostTrap.trap!(key, value)
- if Twurl.options.trace && value
- puts "\n== #{key} (OAuth Trace)"
- puts "#{value}"
- puts "==\n\n"
+ begin
+ if Twurl.options.trace && value
+ puts "\n== #{key} (OAuth Trace)"
+ puts "#{value}"
+ puts "==\n\n"
+ end
+ rescue NameError
+ # Most likely without Twurl. No worries.
end
@@log << { key => value }
end
@@ -47,10 +55,6 @@ def GhostTrap.review_ghosts
end
-# These are all overrides for OAuth gems to make them more debuggable.
-# This could all be done more cleanly. But it isn't. So there.
-
-
module OAuth::Client
class Helper
def signature_base_string(extra_options = {})

0 comments on commit d94e812

Please sign in to comment.