e4u 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -66,13 +66,13 @@ module E4U
66
66
  def utf8
67
67
  hex = unicode.sub(/\A[\>\*\+]/, '')
68
68
  raise if hex.size == 0
69
- hex.split(/\+/, -1).map{ |ch| ch.hex }.pack('U')
69
+ hex.split(/\+/, -1).map{ |ch| ch.hex }.pack('U*')
70
70
  end
71
71
 
72
72
  def cp932
73
73
  hex = unicode.sub(/\A[\>\*\+]/, '')
74
74
  raise if hex.size == 0
75
- chr = hex.split(/\+/, -1).map{ |ch| unicode_to_cp932(ch.hex) }.pack('n')
75
+ chr = hex.split(/\+/, -1).map{ |ch| unicode_to_cp932(ch.hex) }.pack('n*')
76
76
  chr.force_encoding('CP932') if chr.respond_to? :force_encoding
77
77
  chr
78
78
  end
@@ -31,11 +31,11 @@ module E4U
31
31
  end
32
32
 
33
33
  def unicode_emoji
34
- Google::Emoji.new :unicode => self[:unicode]
34
+ Google::Emoji.new self
35
35
  end
36
36
 
37
37
  def google_emoji
38
- Google::Emoji.new self
38
+ Google::Emoji.new self.merge(:unicode => self[:google])
39
39
  end
40
40
  end
41
41
 
@@ -39,6 +39,15 @@ describe E4U::Google do
39
39
  de.sjis.dump.should == "\xF8\x9F".dump
40
40
  end
41
41
 
42
+ it "DoCoMoの複合絵文字が返ってくること" do
43
+ { '00F' => [[0xE63E, 0xE63F].pack('U*'), [0xF89F, 0xF8A0].pack('n*')],
44
+ '4B8' => [[0xE669, 0xE6EF].pack('U*'), [0xF8CA, 0xF994].pack('n*')] }.each do |id, (utf8, sjis)|
45
+ de = @google.find{ |e| e[:id] == id }.docomo_emoji
46
+ de.utf8.should == utf8
47
+ de.sjis.should == sjis
48
+ end
49
+ end
50
+
42
51
  it "kddi_emojiでE4U::KDDI::Emojiが返ってくること" do
43
52
  ke = @google.find{ |e| e[:id] == '000' }.kddi_emoji
44
53
  ke.should be_instance_of E4U::KDDI::Emoji
@@ -46,6 +55,22 @@ describe E4U::Google do
46
55
  ke.sjis.dump.should == "\xF6\x60".dump
47
56
  end
48
57
 
58
+ it "KDDIの複合絵文字が返ってくること" do
59
+ { '331' => [[0xE471, 0xE5B1].pack('U*'), [0xF649, 0xF7CE].pack('n*')], }.each do |id, (utf8, sjis)|
60
+ de = @google.find{ |e| e[:id] == id }.kddi_emoji
61
+ de.utf8.should == utf8
62
+ de.sjis.should == sjis
63
+ end
64
+ end
65
+
66
+ it "KDDI(Web)の複合絵文字が返ってくること" do
67
+ { '331' => [[0xEF49, 0xF0CE].pack('U*'), [0xF649, 0xF7CE].pack('n*')], }.each do |id, (utf8, sjis)|
68
+ de = @google.find{ |e| e[:id] == id }.kddiweb_emoji
69
+ de.utf8.should == utf8
70
+ de.sjis.should == sjis
71
+ end
72
+ end
73
+
49
74
  it "softbank_emojiでE4U::Softbank::Emojiが返ってくること" do
50
75
  se = @google.find{ |e| e[:id] == '000' }.softbank_emoji
51
76
  se.should be_instance_of E4U::Softbank::Emoji
@@ -53,6 +78,26 @@ describe E4U::Google do
53
78
  se.sjis.dump.should == "\xF9\x8B".dump
54
79
  end
55
80
 
81
+ it "Softbankの複合絵文字が返ってくること" do
82
+ { '00F' => [[0xE04A, 0xE049].pack('U*'), [0xF98B, 0xF98A].pack('n*')],
83
+ '331' => [[0xE415, 0xE331].pack('U*'), [0xFB55, 0xF9D1].pack('n*')],
84
+ '824' => [[0xE103, 0xE328].pack('U*'), [0xF743, 0xF9C8].pack('n*')], }.each do |id, (utf8, sjis)|
85
+ de = @google.find{ |e| e[:id] == id }.softbank_emoji
86
+ de.utf8.should == utf8
87
+ de.sjis.should == sjis
88
+ end
89
+ end
90
+
91
+ it "Unicode絵文字が返ってくること" do
92
+ ue = @google.find{ |e| e[:id] == '000' }.unicode_emoji
93
+ ue.utf8.should == [0x2600].pack('U')
94
+ end
95
+
96
+ it "Google絵文字が返ってくること" do
97
+ ue = @google.find{ |e| e[:id] == '000' }.google_emoji
98
+ ue.utf8.should == [0xFE000].pack('U')
99
+ end
100
+
56
101
  describe E4U::Google::Emoji do
57
102
  before :all do
58
103
  @emj = @google.find{ |e| e[:id] == '000' }.google_emoji
@@ -106,7 +151,8 @@ describe E4U::Google do
106
151
  end
107
152
 
108
153
  it "utf8が返ってくること" do
109
- @emj.utf8.should == [0x2600].pack('U')
154
+ @emj.unicode.should == 'FE000'
155
+ @emj.utf8.should == [0xFE000].pack('U')
110
156
  end
111
157
 
112
158
  it "should respond to in_proposal" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e4u
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - fistfvck
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-24 00:00:00 +09:00
12
+ date: 2010-01-07 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency