Created
October 20, 2011 17:24
-
-
Save siyo/1301720 to your computer and use it in GitHub Desktop.
複数行のtweetも綺麗に出力したいとき用earthquake.gem plugin (Earthquake.config[:raw_text] = true 時)
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 -*- | |
# | |
# ~/.earthquake/config | |
# | |
# Earthquake.config[:raw_text] = true | |
# | |
Earthquake.init do | |
output_filter do |item| | |
next unless Earthquake.config[:raw_text] && item && item["user"] | |
n = item["user"]["screen_name"].size + 8 | |
n += item["_mark"].to_i if item["_mark"] | |
n += if item["retweeted_status"] | |
item["retweeted_status"]["user"]["screen_name"].size + 6 | |
else | |
0 | |
end | |
txt = if item["retweeted_status"] && item["truncated"] | |
item["retweeted_status"]["text"] | |
else | |
item["text"] | |
end | |
txt.gsub!("\n","%s%*s" % ["\n",n,""]) | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
screenshot : http://gyazo.com/751af12f40315d239a58727c7f9da08d.png