gemojione 4.2.0 β†’ 4.3.0

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: a9f1ad4d310299fc617f7b135d3f7b1d4e026aa7e623765261ea0f7daf39f057
4
- data.tar.gz: 0f93e79cae2483adb75ed675924aea1a73b4038fa63923d63741737a06bfe953
3
+ metadata.gz: abb4566cfbab762f7c4c6b7e87bc106ef892a2616d8f3f759b6364deb361dbf2
4
+ data.tar.gz: 64840895541de747e290269a6896220ed94342c4e23575c5c0d0ee6f2846cfe2
5
5
  SHA512:
6
- metadata.gz: 81ad1fc4b6dfe56876a83dd7573f8ec12a223554b085a76b972bb88fc388acf7aa45bb40995c8ff7b16ed5d21d879c8662b98121002b70818b6847de7b227c12
7
- data.tar.gz: 447456f6aebe9948c5305d708b2fa5017ebadb6d219da174ab2ebf4cc6160d70b9df0161bf4ac7f47bda8f74cc560a5398da0eaaa79ba0b3576ddffc0e362d23
6
+ metadata.gz: da2aaacb48433207571112827ef257e1e319b892d393c25a0f65996a79040f647a626978045dff7385ec5a2a40651797fece62adb0c74fa256ed137870176620
7
+ data.tar.gz: 6731b8529171d8b4c272a2ad0c7e27d4c19c60bfe4cbdfc67eb5a71a9d97892b57b858331fa9558fa1910d19cde2d9fb826d8ba92dfc94b0d5d6ce63218c92f7
data/README.md CHANGED
@@ -94,6 +94,13 @@ Emoji Library Index APIs:
94
94
  => {"unicode"=>"1F604", "unicode_alternates"=>[], "name"=>"smile", "shortname"=>":smile:", "category"=>"people", "aliases"=>[], "aliases_ascii"=>[":)", ":-)", "=]", "=)", ":]"], "keywords"=>["face", "funny", "haha", "happy", "joy", "laugh", "smile", "smiley", "smiling", "emotion"], "moji"=>"πŸ˜„","description"=>"smiling face with open mouth and smiling eyes"}
95
95
  ```
96
96
 
97
+ Other:
98
+
99
+ ```ruby
100
+ > Gemojione.replace_named_moji_with_unicode_moji("Going for a walk! :woman_walking:")
101
+ => "Going for a walk! πŸšΆβ€β™€οΈ"
102
+ ```
103
+
97
104
  Default configuration integrates with Rails, but you can change it with an initializer:
98
105
 
99
106
  ```ruby
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "json"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "minitest"
26
26
  spec.add_development_dependency "sprite-factory"
@@ -124,6 +124,24 @@ module Gemojione
124
124
  safe_string
125
125
  end
126
126
 
127
+ def self.replace_named_moji_with_unicode_moji(string)
128
+ return string unless string
129
+ unless string.match(index.shortname_moji_regex)
130
+ return safe_string(string)
131
+ end
132
+
133
+ safe_string = safe_string(string.dup)
134
+ safe_string.gsub!(index.shortname_moji_regex) do |code|
135
+ name = code.tr(':','')
136
+ moji = index.find_by_name(name)
137
+ moji['moji']
138
+ end
139
+
140
+ safe_string = safe_string.html_safe if safe_string.respond_to?(:html_safe)
141
+
142
+ safe_string
143
+ end
144
+
127
145
  def self.replace_ascii_moji_with_images(string)
128
146
  return string unless string
129
147
  unless string.match(index.ascii_moji_regex)
@@ -101,7 +101,7 @@ module Gemojione
101
101
  def activity
102
102
  """
103
103
  soccer basketball football baseball tennis volleyball rugby_football 8ball ping_pong badminton goal hockey field_hockey
104
- cricket golf bow_and_arrow fishing_pole_and_fish boxing_glove martial_arts_uniform ice_skate ski skier snowboarder
104
+ cricket_game golf bow_and_arrow fishing_pole_and_fish boxing_glove martial_arts_uniform ice_skate ski skier snowboarder
105
105
  woman_lifting_weights man_lifting_weights person_fencing women_wrestling men_wrestling woman_cartwheeling
106
106
  man_cartwheeling woman_bouncing_ball man_bouncing_ball woman_playing_handball man_playing_handball woman_golfing
107
107
  man_golfing woman_surfing man_surfing woman_swimming man_swimming woman_playing_water_polo
@@ -1,3 +1,3 @@
1
1
  module Gemojione
2
- VERSION = "4.2.0"
2
+ VERSION = "4.3.0"
3
3
  end
@@ -263,6 +263,13 @@ describe Gemojione do
263
263
  end
264
264
  end
265
265
 
266
+ describe 'replace_named_moji_with_unicode_moji' do
267
+ it 'should replace emoji name with unicode moji' do
268
+ replaced_string = Gemojione.replace_named_moji_with_unicode_moji("Going for a walk! :woman_walking:")
269
+ assert_equal "Going for a walk! πŸšΆβ€β™€οΈ", replaced_string
270
+ end
271
+ end
272
+
266
273
  describe "replace_ascii_moji_with_images" do
267
274
  it 'should replace ascii moji with img tag' do
268
275
  replaced_string = Gemojione.replace_ascii_moji_with_images("Emoji is :-)")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemojione
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Klabnik
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-06-15 00:00:00.000000000 Z
14
+ date: 2019-06-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json
@@ -31,16 +31,16 @@ dependencies:
31
31
  name: bundler
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: '1.3'
36
+ version: '0'
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "~>"
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '1.3'
43
+ version: '0'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: rake
46
46
  requirement: !ruby/object:Gem::Requirement