Created
July 23, 2011 14:37
-
-
Save no6v/1101498 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/earthquake/commands.rb b/lib/earthquake/commands.rb | |
index 182dea9..7a4391e 100644 | |
--- a/lib/earthquake/commands.rb | |
+++ b/lib/earthquake/commands.rb | |
@@ -212,10 +212,13 @@ Earthquake.init do | |
end | |
command %r|^:open\s+(\d+)$|, :as => :open do |m| | |
- if match = twitter.status(m[1])["text"].match(URI.regexp(["http", "https"])) | |
- browse match[0] | |
- else | |
+ uris = URI.extract(twitter.status(m[1])["text"], %w[http https]) | |
+ if uris.empty? | |
puts "no link found".c(41) | |
+ else | |
+ uris.each do |uri| | |
+ browse(uri) | |
+ end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment