Avoid using a weird syntax for documentation
Following up 465bd972ec2. If the actual implementation still resides in C, it should be documented in C just like all other places.
This commit is contained in:
parent
006682d391
commit
344c16eba4
17
numeric.c
17
numeric.c
@ -6008,7 +6008,22 @@ rb_int_s_isqrt(VALUE self, VALUE num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* :nodoc: */
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* Integer.try_convert(object) -> object, integer, or nil
|
||||||
|
*
|
||||||
|
* If +object+ is an \Integer object, returns +object+.
|
||||||
|
* Integer.try_convert(1) # => 1
|
||||||
|
*
|
||||||
|
* Otherwise if +object+ responds to <tt>:to_int</tt>,
|
||||||
|
* calls <tt>object.to_int</tt> and returns the result.
|
||||||
|
* Integer.try_convert(1.25) # => 1
|
||||||
|
*
|
||||||
|
* Returns +nil+ if +object+ does not respond to <tt>:to_int</tt>
|
||||||
|
* Integer.try_convert([]) # => nil
|
||||||
|
*
|
||||||
|
* Raises an exception unless <tt>object.to_int</tt> returns an \Integer object.
|
||||||
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
int_s_try_convert(VALUE self, VALUE num)
|
int_s_try_convert(VALUE self, VALUE num)
|
||||||
{
|
{
|
||||||
|
22
numeric.rb
22
numeric.rb
@ -296,28 +296,6 @@ class Integer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# call-seq:
|
|
||||||
# Integer.try_convert(object) -> object, integer, or nil
|
|
||||||
#
|
|
||||||
# If +object+ is an \Integer object, returns +object+.
|
|
||||||
# Integer.try_convert(1) # => 1
|
|
||||||
#
|
|
||||||
# Otherwise if +object+ responds to <tt>:to_int</tt>,
|
|
||||||
# calls <tt>object.to_int</tt> and returns the result.
|
|
||||||
# Integer.try_convert(1.25) # => 1
|
|
||||||
#
|
|
||||||
# Returns +nil+ if +object+ does not respond to <tt>:to_int</tt>
|
|
||||||
# Integer.try_convert([]) # => nil
|
|
||||||
#
|
|
||||||
# Raises an exception unless <tt>object.to_int</tt> returns an \Integer object.
|
|
||||||
#
|
|
||||||
def Integer.try_convert(num)
|
|
||||||
=begin
|
|
||||||
Primitive.attr! 'inline'
|
|
||||||
Primitive.cexpr! 'rb_check_integer_type(num)'
|
|
||||||
=end
|
|
||||||
end if false
|
|
||||||
|
|
||||||
class Float
|
class Float
|
||||||
#
|
#
|
||||||
# call-seq:
|
# call-seq:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user