Class: E4U::Softbank::Emoji
Instance Attribute Summary
Attributes inherited from Base::Emoji
#fallback_text
Instance Method Summary
collapse
Methods inherited from Base::Emoji
#alternate?, #cp932, #fallback?, #initialize, #utf8
Instance Method Details
23
|
# File 'lib/e4u/softbank.rb', line 23
def name_ja; nil end
|
24
|
# File 'lib/e4u/softbank.rb', line 24
def number; nil end
|
25
|
# File 'lib/e4u/softbank.rb', line 25
def unicode; nil end
|
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
end
|