emoji 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +50 -31
- data/emoji.gemspec +2 -2
- data/lib/emoji.rb +2 -2
- data/lib/emoji/index.rb +2 -1
- data/lib/emoji/version.rb +1 -1
- data/test/emoji_test.rb +1 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3d7df5281fcc91b481f756f9b00ec60ce7913f8
|
4
|
+
data.tar.gz: 0b57115afa01104c4feae9487c70ef0fa4eb3285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa9dd31820e607c47e33b257078c64965acc25d18c7fc1542c217b9a02eac166dc0c79e487099fe66d95ebca7cbe7d02708cd42712cde9942e4b42e12ca732a3
|
7
|
+
data.tar.gz: 76ef2ae9bd9f69895c3bf5ad00a65e061416fa08eb5ac443cefc7975412cc9c515326fae53d4b4fa7bb882b318f9bf7844ae4500d2ca07f286c525319ad08795
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -2,13 +2,17 @@
|
|
2
2
|
|
3
3
|
A Ruby gem. For emoji. For everyone. :heart:
|
4
4
|
|
5
|
-
This gem
|
5
|
+
This gem exposes the [Phantom Open Emoji library](https://github.com/Genshin/PhantomOpenEmoji) unicode/image assets and APIs for working with them.
|
6
|
+
|
7
|
+
Easily lookup emoji name, unicode character, or image assets and convert emoji representations.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
11
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'emoji'
|
15
|
+
```
|
12
16
|
|
13
17
|
And then execute:
|
14
18
|
|
@@ -35,50 +39,58 @@ You can use this gem to replace unicode emoji characters with img tags linking t
|
|
35
39
|
|
36
40
|
Image Replacement APIs:
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
```ruby
|
43
|
+
> Emoji.replace_unicode_moji_with_images('I ❤ Emoji')
|
44
|
+
=> "I <img class=\"emoji\" src=\"http://localhost:3000/assets/emoji/heart.png\"> Emoji"
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
> Emoji.image_url_for_unicode_moji('❤')
|
47
|
+
=> "http://localhost:3000/assets/emoji/heart.png"
|
48
|
+
|
49
|
+
> Emoji.image_url_for_name('heart')
|
50
|
+
=> "http://localhost:3000/assets/emoji/heart.png"
|
51
|
+
```
|
46
52
|
|
47
53
|
Emoji Library Index APIs:
|
48
54
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
> index.find_by_moji('❤')
|
55
|
-
=> {"moji"=>"❤", "name"=>"heart", "name-ja"=>"ハート", "category"=>"abstract", "unicode"=>"2764"}
|
55
|
+
```ruby
|
56
|
+
> index = Emoji::Index.new
|
57
|
+
|
58
|
+
> index.find_by_name('heart')
|
59
|
+
=> {"moji"=>"❤", "name"=>"heart", "name-ja"=>"ハート", "category"=>"abstract", "unicode"=>"2764"}
|
56
60
|
|
61
|
+
> index.find_by_moji('❤')
|
62
|
+
=> {"moji"=>"❤", "name"=>"heart", "name-ja"=>"ハート", "category"=>"abstract", "unicode"=>"2764"}
|
63
|
+
```
|
57
64
|
Default configuration integrates with Rails, but you can change it with an initializer:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
# config/initializers/emoji.rb
|
68
|
+
Emoji.asset_host = "emoji.cdn.com"
|
69
|
+
Emoji.asset_path = '/assets/emoji'
|
70
|
+
```
|
62
71
|
|
63
72
|
String Helper Methods:
|
64
73
|
|
65
74
|
You can also
|
66
75
|
|
67
|
-
|
76
|
+
```ruby
|
77
|
+
include 'emoji/string_ext'
|
78
|
+
```
|
68
79
|
|
69
80
|
and call methods directly on your string to return the same results:
|
70
81
|
|
71
|
-
|
72
|
-
|
82
|
+
```ruby
|
83
|
+
> 'I ❤ Emoji'.with_emoji_images
|
84
|
+
=> "I <img class=\"emoji\" src=\"http://localhost:3000/assets/emoji/heart.png\"> Emoji"
|
73
85
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
> 'heart'.emoji_data
|
79
|
-
> '❤'.emoji_data
|
80
|
-
=> {"moji"=>"❤", "name"=>"heart", "name-ja"=>"ハート", "category"=>"abstract", "unicode"=>"2764"}
|
86
|
+
> 'heart'.image_url
|
87
|
+
> '❤'.image_url
|
88
|
+
=> "http://localhost:3000/assets/emoji.heart.png"
|
81
89
|
|
90
|
+
> 'heart'.emoji_data
|
91
|
+
> '❤'.emoji_data
|
92
|
+
=> {"moji"=>"❤", "name"=>"heart", "name-ja"=>"ハート", "category"=>"abstract", "unicode"=>"2764"}
|
93
|
+
```
|
82
94
|
|
83
95
|
## HTML Safety and Performance
|
84
96
|
|
@@ -88,8 +100,15 @@ The emoji gem will try to use `escape_utils` if it's available, but does not req
|
|
88
100
|
|
89
101
|
To enable native HTML escaping, add this line to your application's Gemfile:
|
90
102
|
|
91
|
-
|
103
|
+
```ruby
|
104
|
+
gem 'escape_utils'
|
105
|
+
```
|
106
|
+
## Contributors: :heart:
|
92
107
|
|
108
|
+
* [@ryan-orr](https://github.com/ryan-orr): Granted the official `emoji` rubygems account
|
109
|
+
* [@mikowitz](https://github.com/mikowitz): `String` ext helpers
|
110
|
+
* [@semanticart](https://github.com/semanticart): Cleanup/Ruby 1.9.3 support
|
111
|
+
* [@parndt](https://github.com/parndt): README doc fixes
|
93
112
|
|
94
113
|
## Contributing
|
95
114
|
|
data/emoji.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'emoji/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "emoji"
|
8
8
|
spec.version = Emoji::VERSION
|
9
|
-
spec.authors = ["Steve Klabnik"]
|
10
|
-
spec.email = ["steve@steveklabnik.com"]
|
9
|
+
spec.authors = ["Steve Klabnik", "Winfield Peterson"]
|
10
|
+
spec.email = ["steve@steveklabnik.com", "winfield.peterson@gmail.com"]
|
11
11
|
spec.description = %q{A Ruby gem. For emoji. For everyone. :heart:}
|
12
12
|
spec.summary = %q{A Ruby gem. For emoji. For everyone. :heart:}
|
13
13
|
spec.homepage = "http://github.com/steveklabnik/emoji"
|
data/lib/emoji.rb
CHANGED
@@ -48,9 +48,9 @@ module Emoji
|
|
48
48
|
end
|
49
49
|
|
50
50
|
if string.respond_to?(:html_safe?) && string.html_safe?
|
51
|
-
safe_string = string
|
51
|
+
safe_string = string.dup
|
52
52
|
else
|
53
|
-
safe_string = escape_html(string)
|
53
|
+
safe_string = escape_html(string.dup)
|
54
54
|
end
|
55
55
|
|
56
56
|
safe_string.gsub!(index.unicode_moji_regex) do |moji|
|
data/lib/emoji/index.rb
CHANGED
@@ -5,6 +5,7 @@ module Emoji
|
|
5
5
|
emoji_json = File.read(File.absolute_path(File.dirname(__FILE__) + '/../../config/index.json'))
|
6
6
|
JSON.parse(emoji_json)
|
7
7
|
end
|
8
|
+
|
8
9
|
@emoji_by_name = {}
|
9
10
|
@emoji_by_moji = {}
|
10
11
|
|
@@ -30,4 +31,4 @@ module Emoji
|
|
30
31
|
@emoji_moji_regex
|
31
32
|
end
|
32
33
|
end
|
33
|
-
end
|
34
|
+
end
|
data/lib/emoji/version.rb
CHANGED
data/test/emoji_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Klabnik
|
8
|
+
- Winfield Peterson
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: json
|
@@ -83,12 +84,14 @@ dependencies:
|
|
83
84
|
description: 'A Ruby gem. For emoji. For everyone. :heart:'
|
84
85
|
email:
|
85
86
|
- steve@steveklabnik.com
|
87
|
+
- winfield.peterson@gmail.com
|
86
88
|
executables: []
|
87
89
|
extensions: []
|
88
90
|
extra_rdoc_files: []
|
89
91
|
files:
|
90
92
|
- .gitignore
|
91
93
|
- .rvmrc
|
94
|
+
- CHANGELOG.md
|
92
95
|
- Gemfile
|
93
96
|
- LICENSE.txt
|
94
97
|
- README.md
|
@@ -610,12 +613,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
610
613
|
version: '0'
|
611
614
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
612
615
|
requirements:
|
613
|
-
- - '
|
616
|
+
- - '>='
|
614
617
|
- !ruby/object:Gem::Version
|
615
|
-
version:
|
618
|
+
version: '0'
|
616
619
|
requirements: []
|
617
620
|
rubyforge_project:
|
618
|
-
rubygems_version: 2.0.
|
621
|
+
rubygems_version: 2.0.14
|
619
622
|
signing_key:
|
620
623
|
specification_version: 4
|
621
624
|
summary: 'A Ruby gem. For emoji. For everyone. :heart:'
|
@@ -624,3 +627,4 @@ test_files:
|
|
624
627
|
- test/index_test.rb
|
625
628
|
- test/string_ext_test.rb
|
626
629
|
- test/test_helper.rb
|
630
|
+
has_rdoc:
|