Created
March 31, 2011 08:51
-
-
Save no6v/896054 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
# -*- coding: utf-8 -*- | |
# https://twitter.com/#!/jugyo/status/51959560084275200 | |
Earthquake.init do | |
t = { | |
"u" => ":update", | |
"re" => ":reply", | |
"rt" => ":retweet", | |
"l" => ":recent", | |
"show" => ":status", | |
} | |
input_filter do |text| | |
text.tap do | |
if m = %r|^(#{Regexp.union(t.keys)})(\s+.*)?$|o.match(text) | |
warn("⚡⚡⚡ Hmm, you are a well-trained termtter user :-(.".c(:notice)) | |
warn("⚡⚡⚡ Use '#{t[m[1]]}' instead of '#{m[1]}' on earthquake.gem.".c(:notice)) | |
break [t[m[1]], m[2].gsub(/\$\w+/){|var| var2id(var) || var}].join | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment