steam-id2 0.4.4 → 0.4.5

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
- SHA1:
3
- metadata.gz: ed99ffe307bdb0a96a85b23542c12f3477256354
4
- data.tar.gz: 2d8b93e0cb06c09b42f9f0d5d45aa2a49867de8f
2
+ SHA256:
3
+ metadata.gz: '07832e7aa943366907911352c65312e8df1becbcf55a4db0b4a19e79b69a9d64'
4
+ data.tar.gz: 2adb4ac5f8f9651c297cb95f717ce65efc99869b6f563172f6345836cd475981
5
5
  SHA512:
6
- metadata.gz: aecbaee6e95c4444ddb84c1dfae29d0f87b0d9a8f0df349aec486b31c6a0acdb37b7369ea98602f2425bbbb374008d606d52852698bf2bd6de5e137b9787e542
7
- data.tar.gz: 1773cb0182baee98127acd5d2811f95b572f9b0e16b0dd029228b64be6ce656507bf5e0c86495f6b82b569dd6872481da981b686926ad338b318557fb2436abd
6
+ metadata.gz: d8c8420b42f2d6aebc4c7f560cb3cc150b599f17aa07875d289b93ea3cb47ad16a6d53813ecc34d6056839f2bf8d4241084147131f5076d0ee8044fc5d0fa25b
7
+ data.tar.gz: cbd6e13a7cc9046bcad010c89a27dc68ceb4bd6f445b8002465fddc79a73bd9580988693b60e9461a057e7861b74e7511ef833be2fd74888b2dfcf632c1fd5be
@@ -19,6 +19,14 @@ glance - what to expact from upgrading to a new version.
19
19
  ### Removed
20
20
 
21
21
 
22
+ ## [0.4.5] - 2018-09-09
23
+
24
+ ### Fixed
25
+
26
+ - Handle ID 64s exceeding allowed range, by adding/subtracting multiples of
27
+ range until fitting.
28
+
29
+
22
30
  ## [0.4.4] - 2018-03-25
23
31
 
24
32
  ### Fixed
@@ -96,7 +96,8 @@ module SteamID
96
96
  end
97
97
 
98
98
  PATTERN_STEAM_ID_64.match(id) do |m|
99
- return SteamID.new(m[1].to_i - SteamID::ID_64_OFFSET)
99
+ id = steam_id_64_to_account_id(m[1].to_i)
100
+ return SteamID.new(id)
100
101
  end
101
102
 
102
103
  # Matching this one last, as not to catch an ID 64 on accident.
@@ -150,5 +151,24 @@ module SteamID
150
151
  from_steam_id(steam_id)
151
152
  end
152
153
  end
154
+
155
+ private
156
+ def steam_id_64_to_account_id(id_64)
157
+ account_id = id_64 - SteamID::ID_64_OFFSET
158
+
159
+ # Assuming the range to be [1, 2**32]. But in reality, who knows.
160
+ # /profiles/#{ ID_64_OFFSET } URL (as well as offsets of 2**32 thereof)
161
+ # currently redirect to one's signed-in profile, so seems to have some
162
+ # meta meaning.
163
+ while account_id < 1
164
+ account_id += 2**32
165
+ end
166
+
167
+ while account_id > 2**32
168
+ account_id -= 2**32
169
+ end
170
+
171
+ account_id
172
+ end
153
173
  end
154
174
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "steam-id2"
7
- spec.version = '0.4.4'
7
+ spec.version = '0.4.5'
8
8
  spec.authors = ["Michael Senn"]
9
9
  spec.email = ["michael@morrolan.ch"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam-id2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Senn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-25 00:00:00.000000000 Z
11
+ date: 2018-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: steam-condenser
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.8
138
+ rubygems_version: 2.7.3
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Convert Steam IDs