From 2e7e24a90522df8e435a689bd59d110ed56799d3 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 24 Jun 2021 13:15:11 +0200 Subject: [PATCH] Add a command method in Command This makes it easier for subclasses to only override the command without rewriting the caching implementation. --- lib/serverspec/type/command.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/serverspec/type/command.rb b/lib/serverspec/type/command.rb index d343295f..f946b0c2 100644 --- a/lib/serverspec/type/command.rb +++ b/lib/serverspec/type/command.rb @@ -18,9 +18,14 @@ def exit_status command_result.exit_status.to_i end + protected + def command + @name + end + private def command_result() - @command_result ||= @runner.run_command(@name) + @command_result ||= @runner.run_command(command) end end end