class Tables

Attributes

chars[R]
tables[R]
types[R]

Public Class Methods

new() click to toggle source
# File tools/generate_emoticon_conversion_table.rb, line 53
def initialize
  @chars = []
  @tables = {}
  @types = []
  for name in %w(i2es e2is s2ie)
    table = Table.new("emoji_#{name}.txt")
    @tables[table.type] = table
    @chars |= table.chars
    @types << table.type
  end
end

Public Instance Methods

conv(src, dest_type) click to toggle source
# File tools/generate_emoticon_conversion_table.rb, line 64
def conv(src, dest_type)
  src_type = src[1,1]
  dest = @tables[src_type].conv(src, dest_type)
  dest = nil if dest == "〓"
  dest
end
id_to_unicode(src) click to toggle source
# File tools/generate_emoticon_conversion_table.rb, line 70
def id_to_unicode(src)
  return src if src.nil? || src !~ /^%[ies]\d+%$/
  case src[1,1]
  when "i"
    sjis = tables["i"].code[src]
    return Jpmobile::Emoticon::DOCOMO_SJIS_TO_UNICODE[sjis.to_i(16)]
  when "e"
    sjis = tables["e"].code[src]
    return Jpmobile::Emoticon::AU_SJIS_TO_UNICODE[sjis.to_i(16)]
  when "s"
    webcode = tables["s"].code[src]
    unicode = Jpmobile::Emoticon::SOFTBANK_WEBCODE_TO_UNICODE[webcode]
    return nil unless unicode
    return unicode + 0x1000
  end
end