Refactor with Forwardable module
This commit is contained in:
@@ -2,9 +2,9 @@ module Producer
|
||||
module Core
|
||||
module Tests
|
||||
class ConditionTest < Test
|
||||
def verify
|
||||
condition.met?
|
||||
end
|
||||
extend Forwardable
|
||||
def_delegator :@arguments, :first, :condition_block
|
||||
def_delegator :condition, :met?, :verify
|
||||
|
||||
def condition
|
||||
Condition.evaluate(env, *condition_args, &condition_block)
|
||||
@@ -13,10 +13,6 @@ module Producer
|
||||
def condition_args
|
||||
arguments.drop 1
|
||||
end
|
||||
|
||||
def condition_block
|
||||
arguments.first
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -2,16 +2,15 @@ module Producer
|
||||
module Core
|
||||
module Tests
|
||||
class ShellCommandStatus < Test
|
||||
extend Forwardable
|
||||
def_delegator :@arguments, :first, :command
|
||||
|
||||
def verify
|
||||
remote.execute(command)
|
||||
true
|
||||
rescue RemoteCommandExecutionError
|
||||
false
|
||||
end
|
||||
|
||||
def command
|
||||
arguments.first
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user