Skip to content

Commit

Permalink
Only define compatible method in < Ruby 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Dec 16, 2024
1 parent 31059a8 commit 18f4649
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/securerandom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,9 @@ def bytes(n)

# Compatiblity 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

Expand Down

0 comments on commit 18f4649

Please sign in to comment.