lib/benchmark_driver/config.rb in benchmark_driver-0.10.9 vs lib/benchmark_driver/config.rb in benchmark_driver-0.10.10
- old
+ new
@@ -30,10 +30,20 @@
)
Config::Executable = ::BenchmarkDriver::Struct.new(
:name, # @param [String]
:command, # @param [Array<String>]
- )
+ ) do
+ def initialize(*)
+ super
+ @cache = {} # modifiable storage even after `#freeze`
+ end
+
+ # @return [String] - Return result of `ruby -v`. This is for convenience of output plugins.
+ def description
+ @cache[:description] ||= IO.popen([*command, '-v'], &:read).rstrip
+ end
+ end
Config.defaults[:executables] = [
BenchmarkDriver::Config::Executable.new(name: RUBY_VERSION, command: [RbConfig.ruby]),
]
end