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