mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Rewrite Numeric#dup and Numeric#+@ in Ruby (#11933)
This commit is contained in:
parent
9cbf2f5fff
commit
0f3723c644
Notes:
git
2024-10-22 18:01:48 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>
3 changed files with 19 additions and 52 deletions
19
numeric.rb
19
numeric.rb
|
@ -1,4 +1,14 @@
|
|||
class Numeric
|
||||
# call-seq:
|
||||
# dup -> self
|
||||
#
|
||||
# Returns +self+.
|
||||
#
|
||||
# Related: Numeric#clone.
|
||||
#
|
||||
def dup
|
||||
self
|
||||
end
|
||||
|
||||
# call-seq:
|
||||
# real? -> true or false
|
||||
|
@ -70,6 +80,15 @@ class Numeric
|
|||
end
|
||||
|
||||
alias conj conjugate
|
||||
|
||||
# call-seq:
|
||||
# +self -> self
|
||||
#
|
||||
# Returns +self+.
|
||||
#
|
||||
def +@
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
class Integer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue