lib/benchmark_driver/config.rb in benchmark_driver-0.10.6 vs lib/benchmark_driver/config.rb in benchmark_driver-0.10.7

- old
+ new

@@ -34,6 +34,19 @@ :command, # @param [Array<String>] ) Config.defaults[:executables] = [ BenchmarkDriver::Config::Executable.new(name: RUBY_VERSION, command: [RbConfig.ruby]), ] + + class Config::RbenvExecutable < Config::Executable + def freeze + rbenv_version # avoid `can't modify frozen xxx` + super + end + + def rbenv_version + return @rbenv_version if defined?(@rbenv_version) + match = command.first.match(%r[/(?<version>[^/]+)/bin/ruby\z]) + @rbenv_version = match && match[:version] + end + end end