Created
March 12, 2012 15:49
-
-
Save siyo/2022891 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 -*- | |
# | |
# find kaomoji and replace it with dead | |
Earthquake.init do | |
output_filter do |item| | |
next if item.nil? || item["text"].nil? | |
regexp = /[^\(\342\272\200-\351\276\245ぁ-ヶ…‥!!??]*[\(]+[^\(\)\342\272\200-\351\276\245]+[\);]+[^\(\342\272\200-\351\276\245ぁ-ヶ]*/ | |
dest = ["","爆","即","溺","殴"].shuffle[0] + "死" | |
item["text"].gsub!(regexp,"(%s)" % [dest]) | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment