Class: E4U::Softbank::Emoji

Inherits:
Base::Emoji show all
Defined in:
lib/e4u/softbank.rb

Instance Attribute Summary

Attributes inherited from Base::Emoji

#fallback_text

Instance Method Summary collapse

Methods inherited from Base::Emoji

#alternate?, #cp932, #fallback?, #initialize, #utf8

Constructor Details

This class inherits a constructor from E4U::Base::Emoji

Instance Method Details

#name_jaObject



23
# File 'lib/e4u/softbank.rb', line 23

def name_ja; nil end

#numberObject



24
# File 'lib/e4u/softbank.rb', line 24

def number; nil end

#unicodeObject



25
# File 'lib/e4u/softbank.rb', line 25

def unicode; nil end

#webcodeObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/e4u/softbank.rb', line 27

def webcode
  return NKF.nkf('-m0xWs --oc=CP932', fallback_text) if fallback?
  hex = unicode.sub(/\A[\>\*\+]/, '')
  raise if hex.size == 0
  buf = []
  prev = nil
  hex.split(/\+/, -1).each do |e|
    code = e.hex
    high = (code & 0x0700) >> 8
    low  = (code & 0x00FF) + 32
    page = %w(G E F O P Q)[high]
    raise unless page
    unless page == prev
      buf << "\x0F" if buf.size > 0
      buf << "\x1B\x24#{page}"
    end
    buf << low.chr
    prev = page
  end
  buf << "\x0F"
  str = buf.join
  #str.force_encoding(???) if str.respond_to? :force_encoding
end