lib/rgot.rb in rgot-0.1.5 vs lib/rgot.rb in rgot-0.2.0
- old
+ new
@@ -6,36 +6,21 @@
require 'rgot/b'
require 'rgot/pb'
require 'rgot/benchmark_result'
require 'rgot/example_parser'
- class OptionError < StandardError
- end
+ OptionError = Class.new(StandardError)
+ InternalTest = Struct.new(:module, :name)
+ InternalBenchmark = Struct.new(:module, :name)
+ InternalExample = Struct.new(:module, :name)
+ ExampleOutput = Struct.new(:name, :output)
- class InternalTest < Struct.new(:module, :name)
- end
-
- class InternalBenchmark < Struct.new(:module, :name)
- end
-
- class InternalExample < Struct.new(:module, :name)
- end
-
- class ExampleOutput < Struct.new(:name, :output)
- end
-
class << self
- if "2.0.0" < RUBY_VERSION
- def now
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
- end
- else
- def now
- Time.now
- end
+ def now
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
- def benchmark(opts_hash={}, &block)
+ def benchmark(opts_hash = {}, &block)
opts = B::Options.new
opts_hash.each do |k, v|
opts[k] = v
end
B.new(nil, nil, opts).run(&block)