use an array of arrays instead of a hash to ensure order, thanks REE!

This commit is contained in:
MrZYX 2011-06-30 23:40:41 +02:00
parent 4e48db23f0
commit 05907246e9

View file

@ -112,23 +112,23 @@ module MarkdownifyHelper
end
def process_emoticons(message)
map = {
"<3" => "♥",
":(" => "☹",
":-(" => "☹",
":)" => "☺",
":-)" => "☺",
"<->" => "↔",
"->" => "→",
"<-" => "←",
"..." => "…",
"(tm)" => "™",
"(r)" => "®",
"(c)" => "©"
}
map = [
["<3", "♥"],
[":(", "☹"],
[":-(", "☹"],
[":)", "☺"],
[":-)", "☺"],
["<->", "↔"],
["->", "→"],
["<-", "←"],
["...", "…"],
["(tm)", "™"],
["(r)", "®"],
["(c)", "©"]
]
map.each do |search, replace|
message.gsub!(search, replace)
map.each do |mapping|
message.gsub!(mapping[0], mapping[1])
end
message
end