letter_avatar 0.3.8 → 0.3.9

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: 6d2586d081f82e47b98f62a86d2838d175335b45ae2aef96c8e53a38196e50f7
4
- data.tar.gz: a14569c36f85e2753f62448003c11f901a41014f17cd6edc12347b55959fe152
3
+ metadata.gz: b6dacffd37b1ed6ffe0bd73e45b53e78633bad53c59ab6efd0aa130e468fde8c
4
+ data.tar.gz: 73a8007813254f22ab63d4c4146fd4ee864f7f3d391fc6d3b268112ad3f521b9
5
5
  SHA512:
6
- metadata.gz: c05404029ccb5e990b3cd03d9b10978713a39174835d04db3fea4905c6b6a0775fd69ed30357b8d4e265745c8e290c14f546710af846200e15c5b5880b48594e
7
- data.tar.gz: 4c37b64aac54ed5d81d77885c357c2ce0b03f90f4c58d54d451229214d031f6e737b062f4d92861d02db0426bee7ee2843fb89d2bcbdede3e1e19ec09bf6f5fa
6
+ metadata.gz: 06a5a887dfcba06b5e1832127ca346ab8f95ff425dca8cb366c1dcab7bab967d3d47112c46f3ddc8c8915ea037a33d8bf96b80fd1163b2f4b69317d9e4c769b4
7
+ data.tar.gz: 4152a78ea6534e2391434a3923932e6548b59228ecf515e131220e1ea390ce20691122654310a634018a58f99d15b699321f8de900dcf25e651272753258f082
data/README.md CHANGED
@@ -54,7 +54,7 @@ LetterAvatar.setup do |config|
54
54
  config.colors_palette = :iwanthue # default is :google
55
55
  config.weight = 500 # default is 300
56
56
  config.annotate_position = '-0+10' # default is -0+5
57
-  config.letters_count = 2 # default is 1
57
+ config.letters_count = 2 # default is 1
58
58
  config.pointsize = 70 # default is 140
59
59
  end
60
60
  ```
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module LetterAvatar
2
4
  class Avatar
3
5
  # BUMP UP if avatar algorithm changes
@@ -41,9 +43,11 @@ module LetterAvatar
41
43
  return filename if cache && File.exist?(filename)
42
44
 
43
45
  fullsize = fullsize_path(identity)
44
- generate_fullsize(identity) if !cache || !File.exist?(fullsize)
45
-
46
+ if !cache || !File.exist?(fullsize)
47
+ generate_fullsize(identity)
48
+ end
46
49
  LetterAvatar.resize(fullsize, filename, size, size) if size != FULLSIZE
50
+
47
51
  filename
48
52
  end
49
53
 
@@ -1,3 +1,5 @@
1
+ require 'digest'
2
+
1
3
  module LetterAvatar
2
4
  module Colors
3
5
  PALETTES = [:google, :iwanthue, :custom]
@@ -256,7 +258,7 @@ module LetterAvatar
256
258
 
257
259
  def self.with_iwanthue(username)
258
260
  iwanthue[
259
- Digest::MD5.hexdigest(username)[0...15].to_i(16) % iwanthue.length
261
+ ::Digest::MD5.hexdigest(username)[0...15].to_i(16) % iwanthue.length
260
262
  ]
261
263
  end
262
264
 
@@ -270,13 +272,13 @@ module LetterAvatar
270
272
  elsif /[\d]/ =~ char
271
273
  google[char.to_i]
272
274
  else
273
- google[Digest::MD5.hexdigest(username)[0...15].to_i(16) % google.length]
275
+ google[::Digest::MD5.hexdigest(username)[0...15].to_i(16) % google.length]
274
276
  end
275
277
  end
276
278
 
277
279
  def self.with_custom(username)
278
280
  custom_palette = LetterAvatar.custom_palette
279
- custom_palette[Digest::MD5.hexdigest(username)[0...15].to_i(16) % custom_palette.length]
281
+ custom_palette[::Digest::MD5.hexdigest(username)[0...15].to_i(16) % custom_palette.length]
280
282
  end
281
283
 
282
284
  def self.valid_custom_palette?(palette)
@@ -1,3 +1,3 @@
1
1
  module LetterAvatar
2
- VERSION = '0.3.8'
2
+ VERSION = '0.3.9'
3
3
  end
data/lib/letter_avatar.rb CHANGED
@@ -31,7 +31,7 @@ module LetterAvatar
31
31
  ).join(' ')
32
32
  )
33
33
  true
34
- rescue
34
+ rescue => e
35
35
  false
36
36
  end
37
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_avatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Discourse Developers
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-04-03 00:00:00.000000000 Z
14
+ date: 2021-09-06 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: Gem for creating letter avatar from user's name
17
17
  email:
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.0.3
52
+ rubygems_version: 3.1.3
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Create nice initals avatars from your users usernames