Skip to content

Commit

Permalink
Convert into String first before Integer
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Apr 20, 2024
1 parent 59e90f2 commit 11372e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/rspec/openapi/extractors/rails.rb
Expand Up @@ -73,8 +73,10 @@ def add_id(path, parameters)
path
end

def number_or_nil(string)
Integer(string || '')
# @param [String, Symbol] path_parameter
# @return [Integer, nil]
def number_or_nil(path_parameter)
Integer(path_parameter.to_s || '')
rescue ArgumentError
nil
end
Expand Down

0 comments on commit 11372e0

Please sign in to comment.