instance method
parse_options
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3Signature
parse_options(args)
Parse command-line options
Parameters
-
argsreq
Source
# File actionpack/lib/action_controller/request_profiler.rb, line 124
def parse_options(args)
OptionParser.new do |opt|
opt.banner = "USAGE: #{$0} [options] [session script path]"
opt.on('-n', '--times [100]', 'How many requests to process. Defaults to 100.') { |v| options[:n] = v.to_i if v }
opt.on('-b', '--benchmark', 'Benchmark instead of profiling') { |v| options[:benchmark] = v }
opt.on('-m', '--measure [mode]', 'Which ruby-prof measure mode to use: process_time, wall_time, cpu_time, allocations, or memory. Defaults to process_time.') { |v| options[:measure] = v }
opt.on('--open [CMD]', 'Command to open profile results. Defaults to "open %s &"') { |v| options[:open] = v }
opt.on('-h', '--help', 'Show this help') { puts opt; exit }
opt.parse args
if args.empty?
puts opt
exit
end
options[:script] = args.pop
end
end
Defined in actionpack/lib/action_controller/request_profiler.rb line 124
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::RequestProfiler