emojidex 0.4.2 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a0ce4435f22fc24586dd81a50e2d1ad58209908
4
- data.tar.gz: 475b4a67442a8516d0b4c067afd836366d349e02
3
+ metadata.gz: bd1e35d3a2d4cc4350a48bf41217d73f69eb4a43
4
+ data.tar.gz: 924813dae07d7e993807321a890ec8c3bee659bf
5
5
  SHA512:
6
- metadata.gz: cd73c2ec186fa8573b00d3a2adba27a1b1483411deefc01e4ecaeec90264dac79894346b75b71b2da31e43aabbce1daf2972accd4bb081a214fd2892ecd6e9ed
7
- data.tar.gz: 5a1ad7ae00db88d7ac8c5fea6db5653d17f8160de03450a571ee58c7cc908589a184c82fa25a9827896130d6795e27ac853b089e933dffe278325ec2a799d363
6
+ metadata.gz: 3d069673ce17204952df7b76792684bd87c254dbd800856da603466f838a32076af19696ce4c54c72af1deb825e0c129c5c77c9ebae5712cf1d10bfb279fa50b
7
+ data.tar.gz: 9c5dbf7cfd034b23ba9e80d9178e0694e647c41490d4ca20aec0aeb8ba8518df267ccc2e85a9065ef6f5cee536d7e6fecc3f3e730afccaf93dde8116cdb9bb31
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'emojidex'
3
- s.version = '0.4.2'
3
+ s.version = '0.5.0'
4
4
  s.license = 'emojiOL'
5
5
  s.summary = 'emojidex Ruby tools'
6
6
  s.description = 'emojidex emoji handling, search and lookup, listing and caching functionality' \
@@ -178,7 +178,7 @@ module Emojidex
178
178
  def associate_customizations
179
179
  @emoji.values.each do |emoji_obj|
180
180
  emoji_obj.combinations.each do |combo|
181
- @emoji[combo.base.to_sym].add_customization(combo)
181
+ @emoji[combo.base.to_sym].add_customization(combo) if @emoji.include? combo.base.to_sym
182
182
  end
183
183
  end
184
184
  end
@@ -37,6 +37,7 @@ module Emojidex
37
37
  if formats.include? :svg
38
38
  for i in 0..(combo.components.length - 1)
39
39
  combo.components[i].each do |component|
40
+ next if component == ''
40
41
  sums[i][component][:svg] = _checksum_for_file("#{@vector_source_path}/#{combo.base}/#{i}/#{component}.svg")
41
42
  end
42
43
  end
@@ -45,6 +46,7 @@ module Emojidex
45
46
  sizes.keys.each do |size|
46
47
  for i in 0..(combo.components.length - 1)
47
48
  combo.components[i].each do |component|
49
+ next if component == ''
48
50
  sums[i][component][:png][size] = _checksum_for_file("#{@raster_source_path}/#{size}/#{combo.base}/#{i}/#{component}.png")
49
51
  end
50
52
  end
@@ -1,5 +1,5 @@
1
1
  require_relative '../../emojidex'
2
- require_relative 'emoji/combination_information'
2
+ require_relative 'emoji/component_set_information'
3
3
  require_relative 'emoji/asset_information'
4
4
 
5
5
  module Emojidex
@@ -21,7 +21,7 @@ module Emojidex
21
21
  :unicode, :tags, :emoticon, :variants, :base,
22
22
  :r18
23
23
 
24
- include Emojidex::Data::EmojiCombinationInformation
24
+ include Emojidex::Data::EmojiComponentSetInformation
25
25
  include Emojidex::Data::EmojiAssetInformation
26
26
 
27
27
  def initialize(details = {})
@@ -1,22 +1,20 @@
1
- require_relative 'combination_asset_information.rb'
1
+ require_relative 'component_set_asset_information.rb'
2
2
 
3
3
  module Emojidex
4
4
  module Data
5
5
  # Combination information container
6
- class Combination
6
+ class ComponentSet
7
7
  # * base: the named base that this combination belongs to
8
8
  # * combinations: combinations starting with this emoji; base/components/component order
9
9
  # * cutomizations: emoji which start customization of this emoji (this is combination base)
10
10
  attr_accessor :base, :component_layer_order, :components
11
11
 
12
- include Emojidex::Data::EmojiCombinationAssetInformation
12
+ include Emojidex::Data::EmojiComponentSetAssetInformation
13
13
 
14
14
  def initialize(code, combination_info, details = {})
15
15
  @base = combination_info[:base]
16
16
 
17
- @components = []
18
- @components << [Emojidex.escape_code(code.to_s)]
19
- combination_info[:components].each { |component_set| @components << component_set }
17
+ @components = combination_info[:components]
20
18
  if combination_info.include? :component_layer_order
21
19
  @component_layer_order = combination_info[:component_layer_order]
22
20
  else
@@ -30,12 +28,10 @@ module Emojidex
30
28
  end
31
29
 
32
30
  def to_json(options = {})
33
- truncated_components = @components.dup
34
- truncated_components.shift
35
31
  {
36
32
  base: @base,
37
33
  component_layer_order: @component_layer_order,
38
- components: truncated_components,
34
+ components: @components,
39
35
  checksums: @checksums
40
36
  }.to_json
41
37
  end
@@ -4,7 +4,7 @@ require_relative '../../defaults'
4
4
  module Emojidex
5
5
  module Data
6
6
  # Asset information for emoji
7
- module EmojiCombinationAssetInformation
7
+ module EmojiComponentSetAssetInformation
8
8
  attr_accessor :checksums, :paths, :remote_checksums
9
9
 
10
10
  def init_asset_info(details = {})
@@ -18,6 +18,7 @@ module Emojidex
18
18
  @components.each do |component_set|
19
19
  component_group = {}
20
20
  component_set.each do |single_component|
21
+ next if single_component == ''
21
22
  component_group[single_component] = {}
22
23
  component_group[single_component][:svg] = nil
23
24
  component_group[single_component][:png] = {}
@@ -1,10 +1,10 @@
1
1
  require_relative '../../defaults'
2
- require_relative 'combination'
2
+ require_relative 'component_set'
3
3
 
4
4
  module Emojidex
5
5
  module Data
6
6
  # Combination information for emoji
7
- module EmojiCombinationInformation
7
+ module EmojiComponentSetInformation
8
8
  attr_accessor :combinations, :customizations
9
9
 
10
10
  def init_combination_info(details)
@@ -21,7 +21,7 @@ module Emojidex
21
21
 
22
22
  def add_combination(combination_info)
23
23
  _check_and_init_combinations
24
- @combinations << Combination.new(@code, combination_info)
24
+ @combinations << ComponentSet.new(@code, combination_info)
25
25
  end
26
26
 
27
27
  def add_customization(combo)
@@ -30,8 +30,8 @@ module Emojidex
30
30
  @customizations.each do |customization|
31
31
  if (customization.base == combo.base) &&
32
32
  (customization.component_layer_order == combo.component_layer_order)
33
- for i in 0..(customization.components.length - 1)
34
- customization.components[i] = customization.components[i] | combo.components[i]
33
+ customization.components.each_with_index do |components, i|
34
+ customization.components[i] = components | combo.components[i]
35
35
  end
36
36
  added = true
37
37
  end
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'faraday_middleware'
2
3
  require 'typhoeus'
3
4
  require 'typhoeus/adapters/faraday'
4
5
  require 'json'
@@ -61,6 +62,7 @@ module Emojidex
61
62
  conn.request :retry, max: @@retries, interval: 0.05, interval_randomness: 0.5,
62
63
  backoff_factor: 2
63
64
  # conn.response :logger
65
+ conn.use FaradayMiddleware::FollowRedirects, limit: 5
64
66
  conn.adapter :typhoeus #Faraday.default_adapter
65
67
  end
66
68
  _kludge_windows if Gem.win_platform?
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.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -90,9 +90,9 @@ files:
90
90
  - lib/emojidex/data/collection/static_collection.rb
91
91
  - lib/emojidex/data/emoji.rb
92
92
  - lib/emojidex/data/emoji/asset_information.rb
93
- - lib/emojidex/data/emoji/combination.rb
94
- - lib/emojidex/data/emoji/combination_asset_information.rb
95
- - lib/emojidex/data/emoji/combination_information.rb
93
+ - lib/emojidex/data/emoji/component_set.rb
94
+ - lib/emojidex/data/emoji/component_set_asset_information.rb
95
+ - lib/emojidex/data/emoji/component_set_information.rb
96
96
  - lib/emojidex/data/extended.rb
97
97
  - lib/emojidex/data/utf.rb
98
98
  - lib/emojidex/defaults.rb