# File tools/generate_emoticon_conversion_table.rb, line 19 def initialize(path) @list = [] @table = {} @code = {} if path =~ /emoji_(.)2(..)/ @type = $1 @dest_types = $2.split(//) else raise Exception, "something is wrong" end open(path) do |f| f.gets # ヘッダを捨てる f.each do |l| a = Iconv.conv("utf-8", "cp932", l).chomp.split(/\t/) @list << a @code[a[0]] = a[1] @table[a[0]] = a[2...a.size] end end end
# File tools/generate_emoticon_conversion_table.rb, line 39 def chars table.keys.sort_by {|x| x.gsub(/\D/,"").to_i } end
# File tools/generate_emoticon_conversion_table.rb, line 42 def conv(src, dest_type) if dest_type == @type src else @table[src][@dest_types.index(dest_type)] end end