emojidex 0.0.23 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +7 -6
- data/Gemfile +0 -2
- data/Guardfile +17 -8
- data/README.md +54 -17
- data/emojidex.gemspec +4 -1
- data/lib/emojidex.rb +12 -10
- data/lib/emojidex/{categories.rb → data/categories.rb} +3 -4
- data/lib/emojidex/{category.rb → data/category.rb} +1 -1
- data/lib/emojidex/data/collection.rb +158 -0
- data/lib/emojidex/data/collection/asset_information.rb +52 -0
- data/lib/emojidex/data/collection/cache.rb +137 -0
- data/lib/emojidex/{collection → data/collection}/moji_data.rb +1 -1
- data/lib/emojidex/data/collection/static_collection.rb +35 -0
- data/lib/emojidex/data/collection_checker.rb +94 -0
- data/lib/emojidex/{emoji.rb → data/emoji.rb} +3 -2
- data/lib/emojidex/data/emoji/asset_information.rb +45 -0
- data/lib/emojidex/data/extended.rb +18 -0
- data/lib/emojidex/data/utf.rb +18 -0
- data/lib/emojidex/defaults.rb +21 -0
- data/lib/emojidex/env_helper.rb +11 -0
- data/lib/emojidex/service/collection.rb +67 -0
- data/lib/emojidex/service/error.rb +9 -0
- data/lib/emojidex/service/indexes.rb +43 -0
- data/lib/emojidex/service/search.rb +82 -0
- data/lib/emojidex/service/transactor.rb +100 -0
- data/lib/emojidex/service/user.rb +233 -0
- data/spec/{categories_spec.rb → emojidex/data/categories_spec.rb} +4 -3
- data/spec/{collection_checker_spec.rb → emojidex/data/collection_checker_spec.rb} +12 -15
- data/spec/{collection_spec.rb → emojidex/data/collection_spec.rb} +40 -23
- data/spec/{emoji_spec.rb → emojidex/data/emoji_spec.rb} +2 -2
- data/spec/{extended_spec.rb → emojidex/data/extended_spec.rb} +21 -10
- data/spec/{utf_spec.rb → emojidex/data/utf_spec.rb} +22 -17
- data/spec/emojidex/service/collection_spec.rb +20 -0
- data/spec/emojidex/service/error_spec.rb +17 -0
- data/spec/emojidex/service/indexes_spec.rb +62 -0
- data/spec/emojidex/service/search_spec.rb +87 -0
- data/spec/emojidex/service/transactor_spec.rb +11 -0
- data/spec/emojidex/service/user_spec.rb +128 -0
- data/spec/spec_helper.rb +9 -62
- metadata +36 -31
- data/lib/emojidex/api/categories.rb +0 -16
- data/lib/emojidex/api/emoji.rb +0 -26
- data/lib/emojidex/api/search/emoji.rb +0 -16
- data/lib/emojidex/client.rb +0 -60
- data/lib/emojidex/collection.rb +0 -156
- data/lib/emojidex/collection/asset_information.rb +0 -49
- data/lib/emojidex/collection/cache.rb +0 -78
- data/lib/emojidex/collection_checker.rb +0 -93
- data/lib/emojidex/emoji/asset_information.rb +0 -20
- data/lib/emojidex/error.rb +0 -15
- data/lib/emojidex/extended.rb +0 -19
- data/lib/emojidex/service.rb +0 -32
- data/lib/emojidex/utf.rb +0 -19
- data/spec/api/categories_spec.rb +0 -49
- data/spec/api/emoji_spec.rb +0 -89
- data/spec/api/search/emoji_spec.rb +0 -30
- data/spec/client_spec.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc13aecee9337bf14e28469269706c2cb3d1591
|
4
|
+
data.tar.gz: e75c72d4d8edd241c833ca7ecb0fb36a9fc350cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c33ca861d40126c552df6af929454c09d1431a00b28c83f5b387b885f13eefb61aaeaa549b59b79997283a7334c0874ea81855ac00bc23780efdf9bb51d04b3
|
7
|
+
data.tar.gz: a77e1f5cedd7308b28fa0f6a267ce746748ef9ebdcbe1430c19c25d12e4fa4b15cf5a3e1bcf105c4ac1c282c7669b41cbe8c960ab58472a140d4fd4a609695e2
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
+
sudo: false
|
4
|
+
|
3
5
|
rvm:
|
4
|
-
- 1.9.3
|
5
6
|
- 2.0.0
|
6
|
-
- 2.1
|
7
|
-
- 2.2.
|
7
|
+
- 2.1
|
8
|
+
- 2.2.3
|
9
|
+
- ruby-head
|
8
10
|
- rbx
|
9
|
-
|
10
|
-
bundler_args: -j4 --without development
|
11
|
+
- jruby-head
|
11
12
|
|
12
13
|
script:
|
13
14
|
- bundle exec rspec
|
14
15
|
|
15
16
|
addons:
|
16
17
|
code_climate:
|
17
|
-
repo_token:
|
18
|
+
repo_token: 1b416949c15b406b4606ead9dc3b29821f3700555aa869e359820a23b95c32a8
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,10 +1,19 @@
|
|
1
|
-
guard :
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# RSpec files
|
6
|
+
rspec = dsl.rspec
|
7
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
8
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
9
|
+
watch(rspec.spec_files)
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
watch('spec/spec_helper.rb') { "spec" }
|
11
|
+
# Ruby files
|
12
|
+
ruby = dsl.ruby
|
13
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
10
14
|
end
|
15
|
+
|
16
|
+
#guard :rubocop do
|
17
|
+
# watch(%r{.+\.rb$})
|
18
|
+
# watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
19
|
+
#end
|
data/README.md
CHANGED
@@ -1,34 +1,71 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/emojidex.png)](http://badge.fury.io/rb/emojidex)
|
2
2
|
[![Build Status](https://travis-ci.org/emojidex/emojidex.png)](https://travis-ci.org/emojidex/emojidex)
|
3
3
|
[![Code Climate](https://codeclimate.com/github/emojidex/emojidex.png)](https://codeclimate.com/github/emojidex/emojidex)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/emojidex/emojidex/badge.svg?service=github)](https://coveralls.io/github/emojidex/emojidex)
|
4
5
|
[![Inline docs](http://inch-ci.org/github/emojidex/emojidex.png?branch=master)](http://inch-ci.org/github/emojidex/emojidex)
|
5
6
|
[![Gitter chat](https://badges.gitter.im/emojidex/emojidex.png)](https://gitter.im/emojidex/emojidex)
|
6
7
|
emojidex
|
7
8
|
========
|
8
9
|
emojidex core tools and scripts in Ruby. Provides a set of tools to utilize emojidex emoji right away in Ruby. Available as the "emojidex" gem.
|
9
10
|
|
11
|
+
Usage
|
12
|
+
=====
|
13
|
+
The emojidex gem can be used either on-line or off-line. Offline components require you to bundle
|
14
|
+
the assets you want to use by including either the emojidex-vectors gem for SVG assets or
|
15
|
+
emojidex-rasters gem for PNG assets. Simply including "emojidex-vectors" or "emojidex-rasters" in
|
16
|
+
your Gemfile or having the gem installed will enable this. Without one or both of these gems
|
17
|
+
installed the off-line components will fall back to connecting to the emojidex service and, if
|
18
|
+
they are unable to connect, will attempt to find the assets in the emojidex cache (usually found
|
19
|
+
in $HOME/.emojidex).
|
20
|
+
|
21
|
+
Off-line
|
22
|
+
--------
|
23
|
+
To use emojidex off-line you simply need to make an instance of one or more of the named
|
24
|
+
collections in the 'emojidex/data' directory:
|
25
|
+
|
26
|
+
For UTF (Unicode Standard) emoji:
|
27
|
+
```
|
28
|
+
require 'emojidex/data/utf'
|
29
|
+
|
30
|
+
emoji = Emojidex::Data::UTF.new
|
31
|
+
```
|
32
|
+
|
33
|
+
For Extended (emojidex Original) emoji:
|
34
|
+
```
|
35
|
+
require 'emojidex/data/extended'
|
36
|
+
|
37
|
+
emoji = Emojidex::Data::Extended.new
|
38
|
+
```
|
39
|
+
|
40
|
+
For all emoji in the cache (will include UTF and Extended if they have been cached):
|
41
|
+
```
|
42
|
+
require 'emojidex/data/collection'
|
43
|
+
|
44
|
+
emoji = Emojidex::Data::Collection.new
|
45
|
+
```
|
46
|
+
|
47
|
+
For a combined set of UTF, Extended and Cached emoji:
|
48
|
+
```
|
49
|
+
require 'emojidex/data/collection'
|
50
|
+
require 'emojidex/data/utf'
|
51
|
+
require 'emojidex/data/extended'
|
52
|
+
|
53
|
+
emoji = Emojidex::Data::Collection.new
|
54
|
+
emoji << Emojidex::Data::UTF.new
|
55
|
+
emoji << Emojidex::Data::Extended.new
|
56
|
+
```
|
57
|
+
|
58
|
+
|
59
|
+
On-line
|
60
|
+
-------
|
61
|
+
WIP
|
62
|
+
|
63
|
+
|
10
64
|
Assets
|
11
65
|
======
|
12
66
|
You can find Vectors here: [emojidex-vectors](https://github.com/emojidex/emojidex-vectors)
|
13
67
|
You can find Rasters here: [emojidex-rasters](https://github.com/emojidex/emojidex-rasters)
|
14
68
|
|
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
|
-
|
32
69
|
License
|
33
70
|
=======
|
34
71
|
emojidex and emojidex tools are licensed under the [emojidex Open License](https://www.emojidex.com/emojidex/emojidex_open_license).
|
data/emojidex.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'emojidex'
|
3
|
-
s.version = '0.0
|
3
|
+
s.version = '0.1.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' \
|
7
7
|
' and user info (favorites/etc).'
|
8
8
|
s.authors = ['Rei Kagetsuki']
|
9
9
|
s.email = 'info@emojidex.com'
|
10
|
+
|
11
|
+
s.required_ruby_version = '>= 2.0'
|
12
|
+
|
10
13
|
s.files = `git ls-files`.split("\n")
|
11
14
|
s.require_paths = ['lib']
|
12
15
|
s.homepage = 'http://developer.emojidex.com'
|
data/lib/emojidex.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require_relative 'emojidex/defaults'
|
2
|
+
require_relative 'emojidex/data/emoji'
|
3
|
+
require_relative 'emojidex/data/collection'
|
4
|
+
require_relative 'emojidex/data/category'
|
5
|
+
require_relative 'emojidex/data/categories'
|
6
|
+
|
7
|
+
# Master emojidex module. Contains a few general helper functions.
|
8
|
+
module Emojidex
|
9
|
+
def self.escape_code(code)
|
10
|
+
code.tr(' ', '_')
|
11
|
+
end
|
12
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module Emojidex
|
3
|
+
module Emojidex::Data
|
4
4
|
# Holds a master list of categories
|
5
5
|
class Categories
|
6
6
|
attr_accessor :categories
|
@@ -40,7 +40,7 @@ module Emojidex
|
|
40
40
|
|
41
41
|
@categories ||= {}
|
42
42
|
raw.each do |category_info|
|
43
|
-
category = Emojidex::Category.new category_info
|
43
|
+
category = Emojidex::Data::Category.new category_info
|
44
44
|
@categories[category.code.to_sym] = category
|
45
45
|
end
|
46
46
|
end
|
@@ -48,8 +48,7 @@ module Emojidex
|
|
48
48
|
# loads standard categories local to the emojidex package
|
49
49
|
# *automatically called on initialize if no options are passed
|
50
50
|
def load_standard_categories
|
51
|
-
load_categories(IO.read(
|
52
|
-
File.expand_path('../../../emoji/categories.json', __FILE__)))
|
51
|
+
load_categories(IO.read(File.expand_path('../../../../emoji/categories.json', __FILE__)))
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require_relative 'emoji'
|
5
|
+
require_relative 'categories'
|
6
|
+
require_relative 'collection/cache'
|
7
|
+
require_relative 'collection/asset_information'
|
8
|
+
require_relative 'collection/moji_data'
|
9
|
+
|
10
|
+
module Emojidex
|
11
|
+
module Data
|
12
|
+
# listing and search of standard UTF emoji
|
13
|
+
class Collection
|
14
|
+
include Emojidex::Data::CollectionCache
|
15
|
+
include Emojidex::Data::CollectionAssetInformation
|
16
|
+
include Emojidex::Data::CollectionMojiData
|
17
|
+
attr_accessor :emoji, :categories,
|
18
|
+
:source_path, :vector_source_path, :raster_source_path
|
19
|
+
|
20
|
+
# Initialize Collection. You can pass a list of emoji to seed the collection
|
21
|
+
def initialize(emoji_list = nil, local_load_path = nil)
|
22
|
+
@emoji = {}
|
23
|
+
@raster_source_path = @vector_source_path = @source_path = nil
|
24
|
+
load_local_collection(local_load_path) unless local_load_path.nil?
|
25
|
+
add_emoji(emoji_list) unless emoji_list.nil?
|
26
|
+
@emoji
|
27
|
+
end
|
28
|
+
|
29
|
+
# Loads an emoji collection on local storage
|
30
|
+
def load_local_collection(path)
|
31
|
+
@source_path = @vector_source_path = @raster_source_path = File.expand_path(path)
|
32
|
+
json = IO.read(@source_path + '/emoji.json')
|
33
|
+
list = JSON.parse(json, symbolize_names: true)
|
34
|
+
add_emoji(list)
|
35
|
+
end
|
36
|
+
|
37
|
+
# each override to map each functionality to the emoji hash values
|
38
|
+
def each(&block)
|
39
|
+
@emoji.values.each(&block)
|
40
|
+
end
|
41
|
+
|
42
|
+
# select override to map select functionality to the emoji hash values
|
43
|
+
def select(&block)
|
44
|
+
@emoji.values.select(&block)
|
45
|
+
end
|
46
|
+
|
47
|
+
def map(&block)
|
48
|
+
@emoji.values.map(&block)
|
49
|
+
end
|
50
|
+
|
51
|
+
def collect(&block)
|
52
|
+
@emoji.values.collect(&block)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Retreives an Emoji object by the actual moji code/character code
|
56
|
+
# Will likely only return moji from UTF collection
|
57
|
+
def find_by_moji(moji)
|
58
|
+
each do |m|
|
59
|
+
return m if m[:moji] == moji
|
60
|
+
end
|
61
|
+
nil
|
62
|
+
end
|
63
|
+
|
64
|
+
alias_method :文字検索, :find_by_moji
|
65
|
+
|
66
|
+
# Gets the emoji with the specified code
|
67
|
+
# Returns the Emoji object or nil if no emoji with that code is found
|
68
|
+
def find_by_code(code)
|
69
|
+
@emoji[code.gsub(/\s/, '_').to_sym]
|
70
|
+
end
|
71
|
+
|
72
|
+
# Locates emoji by Japanese code (original Japanese emoji name [絵文字名])
|
73
|
+
# Only applies to collections that contain JA codes, this function is mapped to
|
74
|
+
# find_by_code for all other implementations (such as client)
|
75
|
+
def find_by_code_ja(code_ja)
|
76
|
+
each do |m|
|
77
|
+
return m if m[:code_ja] == code_ja
|
78
|
+
end
|
79
|
+
nil
|
80
|
+
end
|
81
|
+
|
82
|
+
alias_method :コード検索, :find_by_code_ja
|
83
|
+
|
84
|
+
def find_by_unicode(unicode)
|
85
|
+
unicode = unicode.downcase
|
86
|
+
each do |m|
|
87
|
+
return m if m[:unicode] == unicode
|
88
|
+
end
|
89
|
+
nil
|
90
|
+
end
|
91
|
+
|
92
|
+
def search(criteria = {})
|
93
|
+
Emojidex::Data::Collection.new _sub_search(@emoji.values.dup, criteria)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Get all emoji from this collection that are part of the specified category
|
97
|
+
# Returns a new collection of only emoji in the specified category
|
98
|
+
def category(category_code)
|
99
|
+
categorized = @emoji.values.select { |moji| moji.category == category_code }
|
100
|
+
Emojidex::Data::Collection.new categorized
|
101
|
+
end
|
102
|
+
|
103
|
+
# Check to see if there are emoji in this collection which have the specified categories
|
104
|
+
# Returns true if there are emoji for all secified categories within this collection
|
105
|
+
def category?(*category_codes)
|
106
|
+
(category_codes.uniq - @categories).empty?
|
107
|
+
end
|
108
|
+
|
109
|
+
# Adds emojis to the collection
|
110
|
+
# After add categories are updated
|
111
|
+
def add_emoji(list)
|
112
|
+
list.each do |moji_info|
|
113
|
+
if moji_info.instance_of? Emojidex::Data::Emoji
|
114
|
+
@emoji[moji_info.code.to_sym] = moji_info.dup
|
115
|
+
else
|
116
|
+
emoji = Emojidex::Data::Emoji.new moji_info
|
117
|
+
@emoji[emoji.code.to_sym] = emoji
|
118
|
+
end
|
119
|
+
end
|
120
|
+
categorize
|
121
|
+
associate_variants
|
122
|
+
condense_moji_code_data
|
123
|
+
@emoji
|
124
|
+
end
|
125
|
+
|
126
|
+
alias_method :<<, :add_emoji
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
# Makes a list of all categories which contain emoji in this collection
|
131
|
+
def categorize
|
132
|
+
@categories = @emoji.values.map { |moji| moji.category }
|
133
|
+
@categories.uniq!
|
134
|
+
end
|
135
|
+
|
136
|
+
def associate_variants
|
137
|
+
@emoji.values.each do |emoji_obj|
|
138
|
+
if emoji_obj.code.match(/\(.*\)$/) # this emoji is a variant
|
139
|
+
# check for base
|
140
|
+
base_code = emoji_obj.code.sub(/\(.*\)$/, '').to_sym
|
141
|
+
if @emoji.key? base_code
|
142
|
+
@emoji[base_code].variants << emoji_obj.code.to_sym
|
143
|
+
emoji_obj.base = base_code
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def _sub_search(list, criteria = {})
|
150
|
+
cr = criteria.shift
|
151
|
+
return list if cr.nil?
|
152
|
+
|
153
|
+
list = list.select { |moji| moji if moji[cr[0]] =~ /#{cr[1]}/ }
|
154
|
+
_sub_search(list, criteria)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
require_relative '../../defaults'
|
3
|
+
|
4
|
+
module Emojidex
|
5
|
+
module Data
|
6
|
+
# Asset Information for Collections
|
7
|
+
module CollectionAssetInformation
|
8
|
+
def generate_checksums(formats = Emojidex::Defaults.formats, sizes = Emojidex::Defaults.sizes)
|
9
|
+
@emoji.values.each do |moji|
|
10
|
+
moji.checksums = get_checksums(moji, formats, sizes)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_checksums(moji, formats = Emojidex::Defaults.formats, sizes = Emojidex::Defaults.sizes)
|
15
|
+
sums = {}
|
16
|
+
sums[:svg] = _checksum_for_file("#{@cache_path}/#{moji.code}.svg") if formats.include? :svg
|
17
|
+
if formats.include? :png
|
18
|
+
sums[:png] = {}
|
19
|
+
sizes.keys.each do |size|
|
20
|
+
sums[:png][size] = _checksum_for_file("#{@cache_path}/#{size}/#{moji.code}.png")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
sums
|
24
|
+
end
|
25
|
+
|
26
|
+
def generate_paths(formats = Emojidex::Defaults.formats, sizes = Emojidex::Defaults.sizes)
|
27
|
+
@emoji.values.each do |moji|
|
28
|
+
moji.paths = get_paths(moji, formats, sizes)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_paths(moji, formats = Emojidex::Defaults.formats, sizes = Emojidex::Defaults.sizes)
|
33
|
+
paths = {}
|
34
|
+
path = "#{@cache_path}/#{moji.code}.svg"
|
35
|
+
paths[:svg] = path if File.exist? path
|
36
|
+
if formats.include? :png
|
37
|
+
paths[:png] = {}
|
38
|
+
sizes.keys.each do |size|
|
39
|
+
path = "#{@cache_path}/#{size}/#{moji.code}.png"
|
40
|
+
paths[:png][size] = path if File.exist? path
|
41
|
+
end
|
42
|
+
end
|
43
|
+
paths
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def _checksum_for_file(path)
|
48
|
+
(File.exist? path) ? Digest::MD5.file(path).hexdigest : nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|