summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-12-16 14:02:39 +0900
committergit <svn-admin@ruby-lang.org>2024-12-16 05:35:47 +0000
commit7923e420c49b366db7b10bbeaf17653c3acc24c0 (patch)
treed8208c59e57b49c1e4a8b831061282d91fa5101e
parent3a4433dddd4ba27d23feff83efd9d48604420df8 (diff)
[ruby/securerandom] Only define compatible method in < Ruby 3.3
https://github.com/ruby/securerandom/commit/2c8cdfba7b
-rw-r--r--lib/securerandom.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 0bcd2b6af0..442a71177d 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -53,13 +53,9 @@ module SecureRandom
# Compatibility methods for Ruby 3.2, we can remove this after dropping to support Ruby 3.2
def alphanumeric(n = nil, chars: ALPHANUMERIC)
- if RUBY_VERSION < '3.3'
- n = 16 if n.nil?
- choose(chars, n)
- else
- super n, chars: chars
- end
- end
+ n = 16 if n.nil?
+ choose(chars, n)
+ end if RUBY_VERSION < '3.3'
private