Sha256: 034b78d327b9f5be46d7b751f957019d9de4478e3bc896f90b2515c9fc4a6a4c

Contents?: true

Size: 1.26 KB

Versions: 15

Compression:

Stored size: 1.26 KB

Contents

unless Object.const_defined?(:Encoding)
  $KCODE = 'u'
end

module Jpmobile
  module Emoticon
    SJIS_TO_UNICODE = {}
    SJIS_TO_UNICODE.update(DOCOMO_SJIS_TO_UNICODE)
    SJIS_TO_UNICODE.update(AU_SJIS_TO_UNICODE)
    SJIS_TO_UNICODE.freeze
    UNICODE_TO_SJIS = SJIS_TO_UNICODE.invert.freeze

    if Object.const_defined?(:Encoding)
      sjis_regexp = Proc.new do |sjis|
        Regexp.compile(Regexp.escape([sjis].pack('n').force_encoding("Shift_JIS")))
      end
    else
      sjis_regexp = Proc.new do |sjis|
        Regexp.compile(Regexp.escape([sjis].pack('n'),"s"),nil,'s')
      end
    end

    SJIS_REGEXP = Regexp.union(*SJIS_TO_UNICODE.keys.map{|s| sjis_regexp[s]})
    SOFTBANK_WEBCODE_REGEXP = Regexp.union(*([/(?!)/n]+SOFTBANK_WEBCODE_TO_UNICODE.keys.map{|x| "\x1b\x24#{x}\x0f"}))

    DOCOMO_SJIS_REGEXP      = Regexp.union(*DOCOMO_SJIS_TO_UNICODE.keys.map{|s| sjis_regexp[s]})
    AU_SJIS_REGEXP          = Regexp.union(*AU_SJIS_TO_UNICODE.keys.map{|s| sjis_regexp[s]})
    SOFTBANK_UNICODE_REGEXP = Regexp.union(*SOFTBANK_UNICODE_TO_WEBCODE.keys.map{|x| [x].pack('U')}).freeze

    EMOTICON_UNICODES = UNICODE_TO_SJIS.keys|SOFTBANK_UNICODE_TO_WEBCODE.keys.map{|k|k+0x1000}
    UTF8_REGEXP = Regexp.union(*EMOTICON_UNICODES.map{|x| [x].pack('U')}).freeze
  end
end

Version data entries

15 entries across 12 versions & 1 rubygems

Version Path
jpmobile-0.1.6 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.5 test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.5 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.4 test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.4 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.3 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.2 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.1 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.0 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.0.8 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.0.8 test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.0.pre.4 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.0.pre.3 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.0.pre.2 lib/jpmobile/emoticon/z_combine.rb
jpmobile-0.1.0.pre lib/jpmobile/emoticon/z_combine.rb