Skip to content

Instantly share code, notes, and snippets.

@no6v
Created July 23, 2011 14:37
Show Gist options
  • Save no6v/1101498 to your computer and use it in GitHub Desktop.
Save no6v/1101498 to your computer and use it in GitHub Desktop.
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