| Server IP : 217.160.0.244 / Your IP : 216.73.216.36 Web Server : Apache System : Linux infong-eu155 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64 User : u100174116 ( 6746176) PHP Version : 8.5.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/ruby/3.3.0/irb/command/ |
Upload File : |
module IRB
# :stopdoc:
module Command
class Measure < Base
include RubyArgsExtractor
category "Misc"
description "`measure` enables the mode to measure processing time. `measure :off` disables it."
def initialize(*args)
super(*args)
end
def execute(arg)
if arg&.match?(/^do$|^do[^\w]|^\{/)
warn 'Configure IRB.conf[:MEASURE_PROC] to add custom measure methods.'
return
end
args, kwargs = ruby_args(arg)
execute_internal(*args, **kwargs)
end
def execute_internal(type = nil, arg = nil)
# Please check IRB.init_config in lib/irb/init.rb that sets
# IRB.conf[:MEASURE_PROC] to register default "measure" methods,
# "measure :time" (abbreviated as "measure") and "measure :stackprof".
case type
when :off
IRB.unset_measure_callback(arg)
when :list
IRB.conf[:MEASURE_CALLBACKS].each do |type_name, _, arg_val|
puts "- #{type_name}" + (arg_val ? "(#{arg_val.inspect})" : '')
end
when :on
added = IRB.set_measure_callback(arg)
puts "#{added[0]} is added." if added
else
added = IRB.set_measure_callback(type, arg)
puts "#{added[0]} is added." if added
end
nil
end
end
end
# :startdoc:
end