Class | Jpmobile::Filter::Emoticon::Outer |
In: |
lib/jpmobile/filter.rb
|
Parent: | Base |
絵文字Outer 外部エンコーディング(携帯電話側)とUnicode数値文字参照を相互に変換。
# File lib/jpmobile/filter.rb, line 139 139: def to_external(str, controller) 140: # 使用する変換テーブルの決定 141: table = nil 142: to_sjis = false 143: case controller.request.mobile 144: when Jpmobile::Mobile::Docomo 145: table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO 146: to_sjis = true 147: when Jpmobile::Mobile::Au 148: table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_AU 149: to_sjis = true 150: when Jpmobile::Mobile::Jphone 151: table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK 152: to_sjis = true 153: when Jpmobile::Mobile::Softbank 154: table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK 155: end 156: 157: Jpmobile::Emoticon::unicodecr_to_external(str, table, to_sjis) 158: end
# File lib/jpmobile/filter.rb, line 130 130: def to_internal(str, controller) 131: method_name = "external_to_unicodecr_" + 132: controller.request.mobile.class.name[/::(\w*)$/, 1].downcase 133: if Jpmobile::Emoticon.respond_to?(method_name) 134: Jpmobile::Emoticon.send(method_name, str) 135: else 136: str # 対応する変換メソッドが定義されていない場合は素通し 137: end 138: end