emoji-datasource 14.0.1 → 14.0.2

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
  SHA256:
3
- metadata.gz: b821544f15170c9489e0ce8938978549829e3c925d3ec6444dfacb7c125b94ca
4
- data.tar.gz: bf4e9c21d3c5ea9de80132de4aa56bfec68c705aba979863151d650facc73f77
3
+ metadata.gz: 705920a1ffdf8ca2028830eeb6420d94d23955b1c189613011e666c6028b9a45
4
+ data.tar.gz: bb399eaa99c6448fdda1826fae0921c86ad1f261aa2ec892e4de4815e70e197d
5
5
  SHA512:
6
- metadata.gz: 03d5041a86c4d7bccde94965634abffd3194c7cc3dcfa70e1de6f573ea1b6d444c6382cc0275b88165597247dd1e97f1ced2050ca671c51183fcb62412a8dcea
7
- data.tar.gz: 994db50c5e4221bf51ed491d108d0b3fb48dea1fae2837d3129d39586d8eb7d080e0423bec5aac775eba4ffc0360299bd20cb64b607f4333c0b9f36a6b2805f2
6
+ metadata.gz: 6518b1ac91acc735b23a63bc7405dab7ed4d1c8928a0f850656b9278cd1e32a007d1ded4568b06a68849067faad2e8b7ee52131e1cc1912498ea555ab7aece8e
7
+ data.tar.gz: fa032904d287a9bd0d8a9e1614c6e86dc2f6e90b1b162bcdc357b328e6b187ba2ff0f3069d3bc4836453eb21acaa6688b6bb58db314ed767f4db2019807c8348
data/.rubocop.yml CHANGED
@@ -40,6 +40,9 @@ Metrics/BlockLength:
40
40
  - '*.gemspec'
41
41
  - 'spec/**/*_spec.rb'
42
42
 
43
+ Metrics/AbcSize:
44
+ Max: 18
45
+
43
46
  Lint/MissingSuper:
44
47
  Enabled: false
45
48
 
@@ -33,8 +33,19 @@ module EmojiDatasource
33
33
  def short_names
34
34
  return @data['short_names'] unless @variation
35
35
 
36
- @data['short_names'].map do |short_name|
37
- "#{short_name}::#{variation_emojis.map(&:short_name).join('::')}"
36
+ @short_names ||= @data['short_names'].flat_map do |short_name|
37
+ full_short_name = "#{short_name}::#{variation_emojis.map(&:short_name).join('::')}"
38
+
39
+ # Allow to find complex emojis with multiple equal skin tone codes by single skin tone
40
+ # For some emojis (like :women_holding_hands:) there are special single skin tone emojis.
41
+ # but for others (like :people_holding_hands:) there are no such versions.
42
+ # However, some implementations in the wild (e.g. Slack and EmojiMart) understand codes
43
+ # containing only single skin tone (e.g. `:people_holding_hands::skin-tone-N:`)
44
+ if variation_emojis.size > 1 && variation_emojis.uniq.size == 1
45
+ abbr_short_name = "#{short_name}::#{variation_emojis.first.short_name}"
46
+ end
47
+
48
+ [full_short_name, abbr_short_name].compact
38
49
  end
39
50
  end
40
51
 
@@ -90,7 +101,7 @@ module EmojiDatasource
90
101
  def variation_emojis
91
102
  return [] unless @variation
92
103
 
93
- @variation.split('-').map do |unified|
104
+ @variation_emojis ||= @variation.split('-').map do |unified|
94
105
  EmojiDatasource.find_by_unified(unified)
95
106
  end
96
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmojiDatasource
4
- VERSION = '14.0.1'
4
+ VERSION = '14.0.2'
5
5
  end
@@ -73,7 +73,9 @@ module EmojiDatasource
73
73
  @short_name_lookup_map ||= data.each_with_object({}) do |emoji, result|
74
74
  emoji.short_names.each { |short_name| result[short_name] = emoji }
75
75
  emoji.variations.each do |emoji_variant|
76
- emoji_variant.short_names.each { |short_name| result[short_name] = emoji_variant }
76
+ emoji_variant.short_names.each do |short_name|
77
+ result[short_name] = emoji_variant
78
+ end
77
79
  end
78
80
  end
79
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emoji-datasource
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.0.1
4
+ version: 14.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justas Palumickas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-24 00:00:00.000000000 Z
11
+ date: 2023-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.2.32
135
+ rubygems_version: 3.4.8
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Emoji data from emoji-datasource npm package