summaryrefslogtreecommitdiff
path: root/numeric.rb
diff options
context:
space:
mode:
authorMatheus Richard <[email protected]>2021-12-14 14:12:37 -0300
committer<[email protected]>2021-12-15 02:12:37 +0900
commitb8f7fc361d2cf2266e39e97c57bba6edd6c6edaf ()
treee1ad72f761b95480daa4f1c7be8ca352f4512cee /numeric.rb
parentb32b755ea2446d67fd53b89b68080ad9b66ac68d (diff)
Add examples for Integer.try_convert [ci skip]
Notes: Merged: https://.com/ruby/ruby/pull/5268 Merged-By: nobu <[email protected]>
-rw-r--r--numeric.rb3
1 files changed, 3 insertions, 0 deletions
@@ -233,11 +233,14 @@ end
# Integer.try_convert(object) -> object, integer, or nil
#
# If +object+ is an \Integer object, returns +object+.
#
# Otherwise if +object+ responds to <tt>:to_int</tt>,
# calls <tt>object.to_int</tt> and returns the result.
#
# Returns +nil+ if +object+ does not respond to <tt>:to_int</tt>
#
# Raises an exception unless <tt>object.to_int</tt> returns an \Integer object.
#