[DOC] Move rdoc of Integer#abs to numeric.rb [ci skip]
This commit is contained in:
parent
66a4768f65
commit
465bd972ec
16
numeric.c
16
numeric.c
@ -4670,22 +4670,6 @@ int_to_f(VALUE num)
|
|||||||
return DBL2NUM(val);
|
return DBL2NUM(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Document-method: Integer#abs
|
|
||||||
* Document-method: Integer#magnitude
|
|
||||||
* call-seq:
|
|
||||||
* int.abs -> integer
|
|
||||||
* int.magnitude -> integer
|
|
||||||
*
|
|
||||||
* Returns the absolute value of +int+.
|
|
||||||
*
|
|
||||||
* (-12345).abs #=> 12345
|
|
||||||
* -12345.abs #=> 12345
|
|
||||||
* 12345.abs #=> 12345
|
|
||||||
*
|
|
||||||
* Integer#magnitude is an alias for Integer#abs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
fix_abs(VALUE fix)
|
fix_abs(VALUE fix)
|
||||||
{
|
{
|
||||||
|
14
numeric.rb
14
numeric.rb
@ -70,6 +70,17 @@ class Integer
|
|||||||
Primitive.cexpr! 'rb_int_comp(self)'
|
Primitive.cexpr! 'rb_int_comp(self)'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# call-seq:
|
||||||
|
# int.abs -> integer
|
||||||
|
# int.magnitude -> integer
|
||||||
|
#
|
||||||
|
# Returns the absolute value of +int+.
|
||||||
|
#
|
||||||
|
# (-12345).abs #=> 12345
|
||||||
|
# -12345.abs #=> 12345
|
||||||
|
# 12345.abs #=> 12345
|
||||||
|
#
|
||||||
|
# Integer#magnitude is an alias for Integer#abs.
|
||||||
def abs
|
def abs
|
||||||
Primitive.attr! 'inline'
|
Primitive.attr! 'inline'
|
||||||
Primitive.cexpr! 'rb_int_abs(self)'
|
Primitive.cexpr! 'rb_int_abs(self)'
|
||||||
@ -138,10 +149,13 @@ class Integer
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias magnitude abs
|
||||||
|
=begin
|
||||||
def magnitude
|
def magnitude
|
||||||
Primitive.attr! 'inline'
|
Primitive.attr! 'inline'
|
||||||
Primitive.cexpr! 'rb_int_abs(self)'
|
Primitive.cexpr! 'rb_int_abs(self)'
|
||||||
end
|
end
|
||||||
|
=end
|
||||||
|
|
||||||
# call-seq:
|
# call-seq:
|
||||||
# int.odd? -> true or false
|
# int.odd? -> true or false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user