emojimmy 0.2 โ†’ 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5513dabf657387638cd16c73b8b614e8c7b1a72c
4
- data.tar.gz: 0a8d7a753359eb37bd6d6fe84b0c3b4f8129bb9a
3
+ metadata.gz: 3b91602af2bd44ac75a15100c5adce6812714b88
4
+ data.tar.gz: 78a51100063dd6eecedd9609b86ab887c579a89c
5
5
  SHA512:
6
- metadata.gz: d3bdac1f5e171df53b5fccab2d076a9fe12802a34d1e1eb56473537933e8f52857b3d900980a3223fff0d5ea74b4d4c9f88cd707e6ac3f1e4d0e7999ca5cc498
7
- data.tar.gz: a0494b7a7dfac0a68e47d2b9e30e4c3b76d0ba560a63b920c3bc499943fe24f3016b112b301cf99ea63ace20a1df5f0408c9b5248ff2fa27b40e743812f64e5a
6
+ metadata.gz: 7dbf6643c4f6e8aed569aab2a4421827b6ba99035e55d612f92fb230f8e135d3d3982367be1c597295acef2d0681e80d6dfbe77fdfe41abe38d449ceedaffeb4
7
+ data.tar.gz: 471b750553f24b09955a70c04e8205ef0c4f6fc3c815294dcaee1972929acd8500e27ccfb474f68fa226acec42fca9146eaae539c0d42f542345ca8f0eb9a377
data/README.md CHANGED
@@ -26,16 +26,9 @@ gem 'emojimmy'
26
26
 
27
27
  ### Usage
28
28
 
29
- First, you must enable Emojimmy in an initializer (when your application boots):
30
-
31
- ```ruby
32
- # config/initializers/emojimmy.rb
33
- Emojimmy.initialize!
34
- ```
35
-
36
29
  #### ActiveRecord
37
30
 
38
- Then, you can edit your models to specify which fields will be storing emoji characters:
31
+ You have to edit your models to specify which fields will be storing emoji characters:
39
32
 
40
33
  ```ruby
41
34
  # app/models/comment.rb
data/Rakefile CHANGED
@@ -9,3 +9,13 @@ desc 'Run all specs'
9
9
  RSpec::Core::RakeTask.new(:spec) do |task|
10
10
  task.pattern = 'spec/**/*_spec.rb'
11
11
  end
12
+
13
+ desc 'Start an IRB session with the gem'
14
+ task :console do
15
+ $:.unshift File.expand_path('..', __FILE__)
16
+ require 'emojimmy'
17
+ require 'irb'
18
+
19
+ ARGV.clear
20
+ IRB.start
21
+ end
data/lib/emojimmy.rb CHANGED
@@ -18,13 +18,8 @@ module Emojimmy
18
18
  # Encode the string with Rumoji
19
19
  content = Rumoji.encode(content)
20
20
 
21
- # Trim left characters
22
- content = content.chars.select do |c|
23
- point = c.each_codepoint.to_a.first
24
- point <= 65535
25
- end
26
-
27
- content.join
21
+ # Return the text without any other weird characters
22
+ Emojimmy.strip(content)
28
23
  end
29
24
 
30
25
  # Loop through each {U+...} token in the string and
@@ -34,4 +29,13 @@ module Emojimmy
34
29
 
35
30
  Rumoji.decode(content)
36
31
  end
32
+
33
+ # Loop through each character in the string and
34
+ # remove the all emoji ones
35
+ def self.strip(content)
36
+ content.chars.select do |c|
37
+ point = c.each_codepoint.to_a.first
38
+ point <= 65535
39
+ end.join
40
+ end
37
41
  end
@@ -1,3 +1,3 @@
1
1
  module Emojimmy
2
- VERSION = '0.2'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -11,10 +11,62 @@ describe Emojimmy do
11
11
  end
12
12
 
13
13
  describe :emoji_to_token do
14
- let(:received_text) { 'Hello ๐Ÿ˜๐Ÿ˜ you ๐Ÿ˜ˆ ๐Ÿธ!' }
15
- let(:stored_text) { 'Hello :grin::grin: you :smiling_imp: :frog:!' }
14
+ context 'with a few emoji characters' do
15
+ let(:received_text) { 'Hello ๐Ÿ˜๐Ÿ˜ you ๐Ÿ˜ˆ ๐Ÿธ!' }
16
+ let(:stored_text) { 'Hello :grin::grin: you :smiling_imp: :frog:!' }
17
+
18
+ subject { Emojimmy.emoji_to_token(received_text) }
19
+ it { should eql stored_text }
20
+ end
21
+
22
+ context 'with *all* iOS emoji' do
23
+ let(:received_text) do
24
+ '๐Ÿ˜„๐Ÿ˜ƒ๐Ÿ˜€๐Ÿ˜Šโ˜บ๐Ÿ˜‰๐Ÿ˜๐Ÿ˜˜๐Ÿ˜š๐Ÿ˜—๐Ÿ˜™๐Ÿ˜œ๐Ÿ˜๐Ÿ˜›๐Ÿ˜ณ๐Ÿ˜๐Ÿ˜”๐Ÿ˜Œ๐Ÿ˜’๐Ÿ˜ž๐Ÿ˜ฃ
25
+ ๐Ÿ˜ข๐Ÿ˜‚๐Ÿ˜ญ๐Ÿ˜ช๐Ÿ˜ฅ๐Ÿ˜ฐ๐Ÿ˜…๐Ÿ˜“๐Ÿ˜ฉ๐Ÿ˜ซ๐Ÿ˜จ๐Ÿ˜ฑ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ค๐Ÿ˜–๐Ÿ˜†๐Ÿ˜‹๐Ÿ˜ท๐Ÿ˜Ž๐Ÿ˜ด
26
+ ๐Ÿ˜ต๐Ÿ˜ฒ๐Ÿ˜Ÿ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜ˆ๐Ÿ‘ฟ๐Ÿ˜ฎ๐Ÿ˜ฌ๐Ÿ˜๐Ÿ˜•๐Ÿ˜ฏ๐Ÿ˜ถ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜‘๐Ÿ‘ฒ๐Ÿ‘ณ๐Ÿ‘ฎ๐Ÿ‘ท๐Ÿ’‚
27
+ ๐Ÿ‘ถ๐Ÿ‘ฆ๐Ÿ‘ง๐Ÿ‘จ๐Ÿ‘ฉ๐Ÿ‘ด๐Ÿ‘ต๐Ÿ‘ฑ๐Ÿ‘ผ๐Ÿ‘ธ๐Ÿ˜บ๐Ÿ˜ธ๐Ÿ˜ป๐Ÿ˜ฝ๐Ÿ˜ผ๐Ÿ™€๐Ÿ˜ฟ๐Ÿ˜น๐Ÿ˜พ๐Ÿ‘น๐Ÿ‘บ
28
+ ๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ’€๐Ÿ‘ฝ๐Ÿ’ฉ๐Ÿ”ฅโœจ๐ŸŒŸ๐Ÿ’ซ๐Ÿ’ฅ๐Ÿ’ข๐Ÿ’ฆ๐Ÿ’ง๐Ÿ’ค๐Ÿ’จ๐Ÿ‘‚๐Ÿ‘€๐Ÿ‘ƒ๐Ÿ‘…๐Ÿ‘„
29
+ ๐Ÿ‘๐Ÿ‘Ž๐Ÿ‘Œ๐Ÿ‘ŠโœŠโœŒ๐Ÿ‘‹โœ‹๐Ÿ‘๐Ÿ‘†๐Ÿ‘‡๐Ÿ‘‰๐Ÿ‘ˆ๐Ÿ™Œ๐Ÿ™โ˜๐Ÿ‘๐Ÿ’ช๐Ÿšถ๐Ÿƒ๐Ÿ’ƒ
30
+ ๐Ÿ‘ซ๐Ÿ‘ช๐Ÿ‘ฌ๐Ÿ‘ญ๐Ÿ’๐Ÿ’‘๐Ÿ‘ฏ๐Ÿ™†๐Ÿ™…๐Ÿ’๐Ÿ™‹๐Ÿ’†๐Ÿ’‡๐Ÿ’…๐Ÿ‘ฐ๐Ÿ™Ž๐Ÿ™๐Ÿ™‡๐ŸŽฉ๐Ÿ‘‘๐Ÿ‘’
31
+ ๐Ÿ‘Ÿ๐Ÿ‘ž๐Ÿ‘ก๐Ÿ‘ ๐Ÿ‘ข๐Ÿ‘•๐Ÿ‘”๐Ÿ‘š๐Ÿ‘—๐ŸŽฝ๐Ÿ‘–๐Ÿ‘˜๐Ÿ‘™๐Ÿ’ผ๐Ÿ‘œ๐Ÿ‘๐Ÿ‘›๐Ÿ‘“๐ŸŽ€๐ŸŒ‚๐Ÿ’„
32
+ ๐Ÿ’›๐Ÿ’™๐Ÿ’œ๐Ÿ’šโค๐Ÿ’”๐Ÿ’—๐Ÿ’“๐Ÿ’•๐Ÿ’–๐Ÿ’ž๐Ÿ’˜๐Ÿ’Œ๐Ÿ’‹๐Ÿ’๐Ÿ’Ž๐Ÿ‘ค๐Ÿ‘ฅ๐Ÿ’ฌ๐Ÿ‘ฃ๐Ÿ’ญ
33
+ ๐Ÿถ๐Ÿบ๐Ÿฑ๐Ÿญ๐Ÿน๐Ÿฐ๐Ÿธ๐Ÿฏ๐Ÿจ๐Ÿป๐Ÿท๐Ÿฝ๐Ÿฎ๐Ÿ—๐Ÿต๐Ÿ’๐Ÿด๐Ÿ‘๐Ÿ˜๐Ÿผ๐Ÿง
34
+ ๐Ÿฆ๐Ÿค๐Ÿฅ๐Ÿฃ๐Ÿ”๐Ÿ๐Ÿข๐Ÿ›๐Ÿ๐Ÿœ๐Ÿž๐ŸŒ๐Ÿ™๐Ÿš๐Ÿ ๐ŸŸ๐Ÿฌ๐Ÿณ๐Ÿ‹๐Ÿ„๐Ÿ
35
+ ๐Ÿ€๐Ÿƒ๐Ÿ…๐Ÿ‡๐Ÿ‰๐ŸŽ๐Ÿ๐Ÿ“๐Ÿ•๐Ÿ–๐Ÿ๐Ÿ‚๐Ÿฒ๐Ÿก๐ŸŠ๐Ÿซ๐Ÿช๐Ÿ†๐Ÿˆ๐Ÿฉ๐Ÿพ
36
+ ๐Ÿ’๐ŸŒธ๐ŸŒท๐Ÿ€๐ŸŒน๐ŸŒป๐ŸŒบ๐Ÿ๐Ÿƒ๐Ÿ‚๐ŸŒฟ๐ŸŒพ๐Ÿ„๐ŸŒต๐ŸŒด๐ŸŒฒ๐ŸŒณ๐ŸŒฐ๐ŸŒฑ๐ŸŒผ๐ŸŒ
37
+ ๐ŸŒž๐ŸŒ๐ŸŒš๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”๐ŸŒ•๐ŸŒœ๐ŸŒ›๐ŸŒ™๐ŸŒ๐ŸŒŽ๐ŸŒ๐ŸŒ‹๐ŸŒŒ๐ŸŒ โญ
38
+ โ˜€โ›…โ˜โšกโ˜”โ„โ›„๐ŸŒ€๐ŸŒ๐ŸŒˆ๐ŸŒŠ
39
+ ๐Ÿ ๐Ÿก๐Ÿซ๐Ÿข๐Ÿฃ๐Ÿฅ๐Ÿฆ๐Ÿช๐Ÿฉ๐Ÿจ๐Ÿ’’โ›ช๐Ÿฌ๐Ÿค๐ŸŒ‡๐ŸŒ†๐Ÿฏ๐Ÿฐโ›บ๐Ÿญ๐Ÿ—ผ
40
+ ๐Ÿ—พ๐Ÿ—ป๐ŸŒ„๐ŸŒ…๐ŸŒƒ๐Ÿ—ฝ๐ŸŒ‰๐ŸŽ ๐ŸŽกโ›ฒ๐ŸŽข๐Ÿšขโ›ต๐Ÿšค๐Ÿšฃโš“๐Ÿš€โœˆ๐Ÿ’บ๐Ÿš๐Ÿš‚
41
+ ๐ŸšŠ๐Ÿš‰๐ŸšŽ๐Ÿš†๐Ÿš„๐Ÿš…๐Ÿšˆ๐Ÿš‡๐Ÿš๐Ÿš‹๐Ÿšƒ๐ŸšŽ๐ŸšŒ๐Ÿš๐Ÿš™๐Ÿš˜๐Ÿš—๐Ÿš•๐Ÿš–๐Ÿš›๐Ÿšš
42
+ ๐Ÿšจ๐Ÿš“๐Ÿš”๐Ÿš’๐Ÿš‘๐Ÿš๐Ÿšฒ๐Ÿšก๐ŸšŸ๐Ÿš ๐Ÿšœ๐Ÿ’ˆ๐Ÿš๐ŸŽซ๐Ÿšฆ๐Ÿšฅโš ๐Ÿšง๐Ÿ”ฐโ›ฝ๐Ÿฎ
43
+ ๐ŸŽฐโ™จ๐Ÿ—ฟ๐ŸŽช๐ŸŽญ๐Ÿ“๐Ÿšฉ๐Ÿ‡ฏ๐Ÿ‡ต๐Ÿ‡ฐ๐Ÿ‡ท๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡จ๐Ÿ‡ณ๐Ÿ‡บ๐Ÿ‡ธ๐Ÿ‡ซ๐Ÿ‡ท๐Ÿ‡ช๐Ÿ‡ธ๐Ÿ‡ฎ๐Ÿ‡น๐Ÿ‡ท๐Ÿ‡บ๐Ÿ‡ฌ๐Ÿ‡ง
44
+ 1โƒฃ2โƒฃ3โƒฃ4โƒฃ5โƒฃ6โƒฃ7โƒฃ8โƒฃ9โƒฃ0โƒฃ๐Ÿ”Ÿ๐Ÿ”ข#โƒฃ๐Ÿ”ฃโฌ†โฌ‡โฌ…โžก๐Ÿ” ๐Ÿ”ก๐Ÿ”ค
45
+ โ†—โ†–โ†˜โ†™โ†”โ†•๐Ÿ”„โ—€โ–ถ๐Ÿ”ผ๐Ÿ”ฝโ†ฉโ†ชโ„นโชโฉโซโฌโคตโคด๐Ÿ†—
46
+ ๐Ÿ”€๐Ÿ”๐Ÿ”‚๐Ÿ†•๐Ÿ†™๐Ÿ†’๐Ÿ†“๐Ÿ†–๐Ÿ“ถ๐ŸŽฆ๐Ÿˆ๐Ÿˆฏ๐Ÿˆณ๐Ÿˆต๐Ÿˆด๐Ÿˆฒ๐Ÿ‰๐Ÿˆน๐Ÿˆบ๐Ÿˆถ๐Ÿˆš
47
+ ๐Ÿšป๐Ÿšน๐Ÿšบ๐Ÿšผ๐Ÿšพ๐Ÿšฐ๐Ÿšฎ๐Ÿ…ฟโ™ฟ๐Ÿšญ๐Ÿˆท๐Ÿˆธ๐Ÿˆ‚โ“‚๐Ÿ›‚๐Ÿ›„๐Ÿ›…๐Ÿ›ƒ๐Ÿ‰‘ใŠ™ใŠ—
48
+ ๐Ÿ†‘๐Ÿ†˜๐Ÿ†”๐Ÿšซ๐Ÿ”ž๐Ÿ“ต๐Ÿšฏ๐Ÿšฑ๐Ÿšณ๐Ÿšท๐Ÿšธโ›”โœณโ‡โŽโœ…โœด๐Ÿ’Ÿ๐Ÿ†š๐Ÿ“ณ๐Ÿ“ด
49
+ ๐Ÿ…ฐ๐Ÿ…ฑ๐Ÿ†Ž๐Ÿ…พ๐Ÿ’ โžฟโ™ปโ™ˆโ™‰โ™Šโ™‹โ™Œโ™โ™Žโ™โ™โ™‘โ™’โ™“โ›Ž๐Ÿ”ฏ
50
+ ๐Ÿง๐Ÿ’น๐Ÿ’ฒ๐Ÿ’ฑยฉยฎโ„ขโŒโ€ผโ‰โ—โ“โ•โ”โญ•๐Ÿ”๐Ÿ”š๐Ÿ”™๐Ÿ”›๐Ÿ”œ๐Ÿ”ƒ
51
+ ๐Ÿ•›๐Ÿ•ง๐Ÿ•๐Ÿ•œ๐Ÿ•‘๐Ÿ•๐Ÿ•’๐Ÿ•ž๐Ÿ•“๐Ÿ•Ÿ๐Ÿ•”๐Ÿ• ๐Ÿ••๐Ÿ•ก๐Ÿ•–๐Ÿ•ข๐Ÿ•—๐Ÿ•ฃ๐Ÿ•˜๐Ÿ•ค๐Ÿ•™
52
+ ๐Ÿ•ฅ๐Ÿ•š๐Ÿ•ฆโœ–โž•โž–โž—โ™ โ™ฅโ™ฃโ™ฆ๐Ÿ’ฎ๐Ÿ’ฏโœ”โ˜‘๐Ÿ”˜๐Ÿ”—โžฐใ€ฐใ€ฝ๐Ÿ”ฑ
53
+ โ—ผโ—ปโ—พโ—ฝโ–ชโ–ซ๐Ÿ”บ๐Ÿ”ฒ๐Ÿ”ณโšซโšช๐Ÿ”ด๐Ÿ”ต๐Ÿ”ปโฌœโฌ›๐Ÿ”ถ๐Ÿ”ท๐Ÿ”ธ๐Ÿ”น
54
+ ๐Ÿ‘Ž๐Ÿ‘Šโ”๐Ÿ‘Œ๐Ÿ’›๐Ÿ’ขโ”๐Ÿ‘Š๐Ÿ’™๐ŸŒŸโ•
55
+ ๐Ÿ‘€๐Ÿ‘ƒ๐Ÿ‘…๐Ÿ‘‚๐Ÿ‘„'
56
+ end
57
+
58
+ let(:stored_text) { Emojimmy.emoji_to_token(received_text) }
59
+ it { expect(stored_text.each_codepoint.to_a.max).to be <= 65535 }
60
+ end
61
+ end
62
+
63
+ describe :strip do
64
+ context 'with a few emoji characters' do
65
+ let(:received_text) { 'Hello ๐Ÿ˜๐Ÿ˜ you ๐Ÿ˜ˆ ๐Ÿธ!' }
66
+ let(:stripped_text) { 'Hello you !' }
16
67
 
17
- subject { Emojimmy.emoji_to_token(received_text) }
18
- it { should eql stored_text }
68
+ subject { Emojimmy.strip(received_text) }
69
+ it { should eql stripped_text }
70
+ end
19
71
  end
20
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emojimmy
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rรฉmi Prรฉvost
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-06 00:00:00.000000000 Z
11
+ date: 2013-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord