Release 0.0.1.8.8.7
This commit is contained in:
1 parent
3c8a17aa78
commit
c7beab414c
16283 files changed
+768761
-2
No files matched your search
@@ -0,0 +1,38 @@
|
||||
# Ruby 3 native helpers used by the project.
|
||||
|
||||
class Integer
|
||||
def num_digits
|
||||
value = abs
|
||||
return 1 if value < 1
|
||||
Math.log10(value).to_i + 1
|
||||
end
|
||||
|
||||
# Return an array containing each digit.
|
||||
def split_digits
|
||||
return [0] if zero?
|
||||
|
||||
res = []
|
||||
quotient = abs
|
||||
until quotient.zero?
|
||||
quotient, modulus = quotient.divmod(10)
|
||||
res.unshift(modulus)
|
||||
end
|
||||
res
|
||||
end
|
||||
end
|
||||
|
||||
module Kernel
|
||||
$PRP_REC = [] unless defined?($PRP_REC) && $PRP_REC
|
||||
$prp_console_enabled = false unless defined?($prp_console_enabled)
|
||||
|
||||
unless method_defined?(:_mp_prp_original_p)
|
||||
alias _mp_prp_original_p p
|
||||
end
|
||||
|
||||
def prp(val = nil, color = 0)
|
||||
$PRP_REC = $PRP_REC.last(26) if $PRP_REC.length >= 27
|
||||
$PRP_REC << [val, color]
|
||||
_mp_prp_original_p(val) if $prp_console_enabled
|
||||
val
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user