Class Jpmobile::Filter::Emoticon::Outer
In: lib/jpmobile/filter.rb
Parent: Base

絵文字Outer 外部エンコーディング(携帯電話側)とUnicode数値文字参照を相互に変換。

Methods

Included Modules

ApplyOnlyForMobile

Public Instance methods

[Source]

     # File lib/jpmobile/filter.rb, line 149
149:         def to_external(str, controller)
150:           # 使用する変換テーブルの決定
151:           table = nil
152:           to_sjis = false
153:           case controller.request.mobile
154:           when Jpmobile::Mobile::Docomo
155:             table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO
156:             to_sjis = true
157:           when Jpmobile::Mobile::Au
158:             table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_AU
159:             to_sjis = true
160:           when Jpmobile::Mobile::Jphone
161:             table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK
162:             to_sjis = true
163:           when Jpmobile::Mobile::Softbank
164:             table = Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK
165:           end
166: 
167:           Jpmobile::Emoticon::unicodecr_to_external(str, table, to_sjis)
168:         end

[Source]

     # File lib/jpmobile/filter.rb, line 140
140:         def to_internal(str, controller)
141:           method_name = "external_to_unicodecr_" +
142:             controller.request.mobile.class.name[/::(\w*)$/, 1].downcase
143:           if Jpmobile::Emoticon.respond_to?(method_name)
144:             Jpmobile::Emoticon.send(method_name, str)
145:           else
146:             str # 対応する変換メソッドが定義されていない場合は素通し
147:           end
148:         end

[Validate]