bin/code in code-ruby-0.6.2 vs bin/code in code-ruby-0.6.3
- old
+ new
@@ -7,15 +7,11 @@
OptionParser
.new do |opts|
opts.banner = "Usage: template [options]"
- opts.on(
- "-v",
- "--version",
- "Version of template"
- ) do |input|
+ opts.on("-v", "--version", "Version of template") do |input|
puts Code::Version
exit
end
opts.on(
@@ -46,14 +42,11 @@
"-t TIMEOUT",
"--timeout=TIMEOUT",
"Set timeout in seconds"
) { |timeout| options[:timeout] = timeout.to_f }
- opts.on(
- "--profile",
- "Profile Ruby code"
- ) do |timeout|
+ opts.on("--profile", "Profile Ruby code") do |timeout|
require "ruby-prof"
options[:profile] = true
end
opts.on(
@@ -68,12 +61,10 @@
.parse!
input = options.fetch(:input, "")
context = options.fetch(:context, "")
-if options[:profile]
- RubyProf.start
-end
+RubyProf.start if options[:profile]
if options[:parse]
pp Code::Parser.parse(input).to_raw
else
print Code.evaluate(input, context, io: $stdout, timeout: options[:timeout])