From 05907246e95791fe25e7da90545cee6fed805d24 Mon Sep 17 00:00:00 2001 From: MrZYX Date: Thu, 30 Jun 2011 23:40:41 +0200 Subject: [PATCH] use an array of arrays instead of a hash to ensure order, thanks REE! --- app/helpers/markdownify_helper.rb | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/helpers/markdownify_helper.rb b/app/helpers/markdownify_helper.rb index 5d82f33a6..8131de113 100644 --- a/app/helpers/markdownify_helper.rb +++ b/app/helpers/markdownify_helper.rb @@ -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