emojidex 0.0.22 → 0.0.23
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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/README.md +17 -0
- data/emojidex.gemspec +1 -1
- data/lib/emojidex/category.rb +1 -1
- data/lib/emojidex/collection.rb +28 -6
- data/lib/emojidex/emoji.rb +2 -1
- data/spec/extended_spec.rb +4 -4
- data/spec/utf_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1f1c37ec62d2ad3daa5af377d01369009f4d734
|
4
|
+
data.tar.gz: aa303bb871cb90133a0607a5fe2c50ff7af35162
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96ad63027965d46efa54858616f1b5409b8e7cab814ee9d6114ae8273351b993584ca914baccd906dc1d5e0351852eb08f639ca00c5f90e9ddfb6717639c6838
|
7
|
+
data.tar.gz: 32bc08ccfe71137b7cc2c900870cbf8e66d5b58e696e0f82e2f969ead86b1514f3baa41ab7a852aca32ab7271d241283e00ae7b0ac669153e2be94bab77c9c0f
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,23 @@ Assets
|
|
12
12
|
You can find Vectors here: [emojidex-vectors](https://github.com/emojidex/emojidex-vectors)
|
13
13
|
You can find Rasters here: [emojidex-rasters](https://github.com/emojidex/emojidex-rasters)
|
14
14
|
|
15
|
+
Notes / Caution
|
16
|
+
===============
|
17
|
+
|
18
|
+
Pre 1.8 or non 1.9+ compliant Ruby
|
19
|
+
----------------------------------
|
20
|
+
emojidex uses a variety of tricks and extensively utilizes UTF8/Unicode in ways most other code does not. As such, we do not recommend attempting
|
21
|
+
to run emojidex on non 1.9+ compliant Ruby variants, and instead recommend the latest official Ruby. If you are/must use a non 1.9+ official Ruby
|
22
|
+
and find an issue that can be remedied without imparing functionality or significantly impacting performance please notify us with an issue or
|
23
|
+
submit a pull request with a patch.
|
24
|
+
|
25
|
+
jRuby
|
26
|
+
-----
|
27
|
+
From 1.9 on Ruby is an m17n compliant Code Set Independent languge. jRuby, however, does not fulfill this requirement and has a variety of issues
|
28
|
+
dealing with UTF8 code -and- content. It should be noted that this is NOT so much a fault of jRuby as it is the JRE/JVM, which simply imposes a
|
29
|
+
code set (which in many/most cases is NOT UTF8) on jRuby. Due to this, caution must be excercised when using jRuby. You must make absolutely sure
|
30
|
+
that the Java environment you are using is being run with UTF8 as the code set.
|
31
|
+
|
15
32
|
License
|
16
33
|
=======
|
17
34
|
emojidex and emojidex tools are licensed under the [emojidex Open License](https://www.emojidex.com/emojidex/emojidex_open_license).
|
data/emojidex.gemspec
CHANGED
data/lib/emojidex/category.rb
CHANGED
data/lib/emojidex/collection.rb
CHANGED
@@ -54,11 +54,10 @@ module Emojidex
|
|
54
54
|
# Retreives an Emoji object by the actual moji code/character code
|
55
55
|
# Will likely only return moji from UTF collection
|
56
56
|
def find_by_moji(moji)
|
57
|
-
|
58
|
-
|
59
|
-
result = emoji if emoji[:moji] == moji
|
57
|
+
each do |m|
|
58
|
+
return m if m[:moji] == moji
|
60
59
|
end
|
61
|
-
|
60
|
+
nil
|
62
61
|
end
|
63
62
|
|
64
63
|
alias_method :文字検索, :find_by_moji
|
@@ -73,13 +72,22 @@ module Emojidex
|
|
73
72
|
# Only applies to collections that contain JA codes, this function is mapped to
|
74
73
|
# find_by_code for all other implementations (such as client)
|
75
74
|
def find_by_code_ja(code_ja)
|
76
|
-
each do |
|
77
|
-
return
|
75
|
+
each do |m|
|
76
|
+
return m if m[:code_ja] == code_ja
|
78
77
|
end
|
78
|
+
nil
|
79
79
|
end
|
80
80
|
|
81
81
|
alias_method :コード検索, :find_by_code_ja
|
82
82
|
|
83
|
+
def find_by_unicode(unicode)
|
84
|
+
unicode = unicode.downcase
|
85
|
+
each do |m|
|
86
|
+
return m if m[:unicode] == unicode
|
87
|
+
end
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
83
91
|
def search(criteria = {})
|
84
92
|
Emojidex::Collection.new _sub_search(@emoji.values.dup, criteria)
|
85
93
|
end
|
@@ -109,6 +117,7 @@ module Emojidex
|
|
109
117
|
end
|
110
118
|
end
|
111
119
|
categorize
|
120
|
+
associate_variants
|
112
121
|
condense_moji_code_data
|
113
122
|
@emoji
|
114
123
|
end
|
@@ -123,6 +132,19 @@ module Emojidex
|
|
123
132
|
@categories.uniq!
|
124
133
|
end
|
125
134
|
|
135
|
+
def associate_variants
|
136
|
+
@emoji.values.each do |emoji_obj|
|
137
|
+
if emoji_obj.code.match(/\(.*\)$/) # this emoji is a variant
|
138
|
+
# check for base
|
139
|
+
base_code = emoji_obj.code.sub(/\(.*\)$/, '').to_sym
|
140
|
+
if @emoji.has_key? base_code
|
141
|
+
@emoji[base_code].variants << emoji_obj.code.to_sym
|
142
|
+
emoji_obj.base = base_code
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
126
148
|
def _sub_search(list, criteria = {})
|
127
149
|
cr = criteria.shift
|
128
150
|
return list if cr.nil?
|
data/lib/emojidex/emoji.rb
CHANGED
@@ -4,7 +4,7 @@ module Emojidex
|
|
4
4
|
# emoji base class
|
5
5
|
class Emoji
|
6
6
|
attr_accessor :moji, :category, :code, :code_ja,
|
7
|
-
:unicode, :tags, :emoticon
|
7
|
+
:unicode, :tags, :emoticon, :variants, :base
|
8
8
|
|
9
9
|
include Emojidex::EmojiAssetInformation
|
10
10
|
|
@@ -16,6 +16,7 @@ module Emojidex
|
|
16
16
|
@category = details[:category] ? details[:category].to_sym : :other
|
17
17
|
@tags = details[:tags].map { |tag| tag.to_sym } unless details[:tags].nil?
|
18
18
|
@link = details[:link]
|
19
|
+
@variants, @base = details[:variants] || [], details[:base]
|
19
20
|
@is_wide = details[:is_wide]
|
20
21
|
end
|
21
22
|
|
data/spec/extended_spec.rb
CHANGED
@@ -95,13 +95,13 @@ describe Emojidex::Extended do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'returns all emoji containing the search term as a substring' do
|
98
|
-
expect(ext.search(code: '
|
98
|
+
expect(ext.search(code: 'square', category: 'symbols').emoji.count).to be > 12
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'evaluates regular expressions' do
|
102
|
-
col = ext.search(code: '
|
103
|
-
expect(col.find_by_code('
|
104
|
-
expect(col.find_by_code('
|
102
|
+
col = ext.search(code: 'emoji(?!.*dex$).*', category: 'symbols')
|
103
|
+
expect(col.find_by_code('emoji')).to be_an_instance_of Emojidex::Emoji
|
104
|
+
expect(col.find_by_code('emojidex')).to be_nil
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
data/spec/utf_spec.rb
CHANGED
@@ -52,6 +52,14 @@ describe Emojidex::UTF do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
describe 'emoji[#code].variants' do
|
56
|
+
it 'has collected variants for an emoji' do
|
57
|
+
expect(utf.emoji[:ice_skate].variants).to be_empty
|
58
|
+
expect(utf.emoji[:persevere].variants).to include(:"persevere(p)")
|
59
|
+
expect(utf.emoji[:"persevere(p)"].base).to be(:persevere)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
describe '.cache!' do
|
56
64
|
it 'caches emoji to local storage cache' do
|
57
65
|
tmp_cache_path = File.expand_path('../support/tmpcache', __FILE__)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emojidex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|