boring_avatar 1.1.1 → 1.2.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: f46869d1f86a48d2fb734d7282350c60c334aeef208d4e5e5149beb69a2adc21
4
- data.tar.gz: 24ed5b74ad82e49082b98ef37ee143c701bf503ca4c9e769ff472332c4fdd6a7
3
+ metadata.gz: 3d151685da16183ab2eb32f482d6840817b361f5fcd35235d8f880b3ed0cb7ca
4
+ data.tar.gz: 5eb897db226b9d5471967a7804a622e7c1c05dc505bb6b910209feff1acc1891
5
5
  SHA512:
6
- metadata.gz: 0a0e91e40c01d11e15315da7cd981d39da58b7f5595d0eee4b89708b14019169f50679f7ec1e8739fca96d0356a1ee6b6ba5495786d81d71ca10e7880913f946
7
- data.tar.gz: 2ff116590caa8e185b2557adb37f85c270c5b270414ad233884cf068d6b196a30878f183ca10d4e3fc9dcb919d8ee441e44b8ae8bba956b41dd628c0c09df1bf
6
+ metadata.gz: c133b5572416f5db3a7c2febe146d87cec5e6aa93663292b2cc09c7c9d0fecf48527f5f47c8c887cae52127873c8f1c543bb8a18bff72f1466124c41fde58dfc
7
+ data.tar.gz: f6c922f0e84380775cc038afb15e6bfef2a5b079171e54f85841f381e9320c7664135d9b45aefb2b96e7afac2a5256e8f5280d47cfde448d76625323be8cbab1
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.0.1
1
+ ruby 3.3.4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0 / 2024-08-02
4
+
5
+ - Use same number generation algorithm as JS implementation by @andriusch
6
+
3
7
  ## 1.1.1 / 2023-06-30
4
8
 
5
9
  - Fix for Beam avatar when random color was nil
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boring_avatar (1.1.1)
4
+ boring_avatar (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,6 +11,7 @@ GEM
11
11
 
12
12
  PLATFORMS
13
13
  arm64-darwin-21
14
+ arm64-darwin-23
14
15
  x86_64-darwin-19
15
16
  x86_64-darwin-20
16
17
  x86_64-linux
@@ -4,10 +4,11 @@ require "json"
4
4
 
5
5
  module Util
6
6
  class << self
7
- def get_number(name)
8
- name.chars
9
- .map(&:ord)
10
- .inject(:+)
7
+ def get_number(string)
8
+ string.chars.reduce(0) do |sum, char|
9
+ sum = (sum << 5) - sum + char.ord
10
+ [sum].pack("L").unpack("l").first
11
+ end.abs
11
12
  end
12
13
 
13
14
  def get_random_color(colors, number, range)
@@ -1,3 +1,3 @@
1
1
  module BoringAvatar
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boring_avatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-01 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a simple Ruby implementation of Boring Avatars library
14
14
  email:
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
- rubygems_version: 3.2.15
64
+ rubygems_version: 3.5.16
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: Generate Boring Avatars