Summary
When loading the SDK, Ruby emits the following warning:
/usr/local/bundle/gems/authlete_ruby_sdk-0.0.3.pre.beta/lib/authlete/sdkconfiguration.rb:22: warning: already initialized constant Authlete::SERVERS
/usr/local/bundle/gems/authlete_ruby_sdk-0.0.3.pre.beta/lib/authlete/sdkconfiguration.rb:16: warning: previous definition of SERVERS was here
Root Cause
In lib/authlete/sdkconfiguration.rb, the `SERVERS` constant is assigned twice:
# First assignment (line 16)
SERVERS = [
'https://us.authlete.com',
'https://jp.authlete.com',
'https://eu.authlete.com',
'https://br.authlete.com',
].freeze
# Second assignment (line 22) — Sorbet type annotation, but causes Ruby warning
SERVERS = T.let(SERVERS, T::Array[String])
`T.let` is a Sorbet runtime method that returns its first argument unchanged, but Ruby treats `SERVERS = T.let(...)` as a constant reassignment and emits a warning.
Expected Behavior
No warning should be emitted when loading the SDK.
Suggested Fix
Combine both into a single assignment to avoid the reassignment warning:
SERVERS = T.let([
'https://us.authlete.com',
'https://jp.authlete.com',
'https://eu.authlete.com',
'https://br.authlete.com',
].freeze, T::Array[String])
Environment
- authlete_ruby_sdk: 0.0.3.pre.beta
- Ruby: 3.4
Summary
When loading the SDK, Ruby emits the following warning:
Root Cause
In
lib/authlete/sdkconfiguration.rb, the `SERVERS` constant is assigned twice:`T.let` is a Sorbet runtime method that returns its first argument unchanged, but Ruby treats `SERVERS = T.let(...)` as a constant reassignment and emits a warning.
Expected Behavior
No warning should be emitted when loading the SDK.
Suggested Fix
Combine both into a single assignment to avoid the reassignment warning:
Environment