diff options
author | Steven Danna <steve@opscode.com> | 2015-01-19 09:44:46 +0000 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2015-02-17 08:46:37 -0500 |
commit | 664172ea426c2c0dfd965b69a0e1ae75af34a89f (patch) | |
tree | 1dabbe4a594adb0a941dfbb28787bee98e46cd34 /lib/chef/resource/conditional.rb | |
parent | 671b5d63236841a74ba0c15879027c35e488a849 (diff) | |
download | chef-664172ea426c2c0dfd965b69a0e1ae75af34a89f.tar.gz |
Add Chef::GuardInterpreter.for_resource method to reduce duplication
Diffstat (limited to 'lib/chef/resource/conditional.rb')
-rw-r--r-- | lib/chef/resource/conditional.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/chef/resource/conditional.rb b/lib/chef/resource/conditional.rb index cdc2638ef0..35bdae8d69 100644 --- a/lib/chef/resource/conditional.rb +++ b/lib/chef/resource/conditional.rb @@ -17,7 +17,7 @@ # require 'chef/mixin/shell_out' -require 'chef/guard_interpreter/resource_guard_interpreter' +require 'chef/guard_interpreter' class Chef class Resource @@ -56,7 +56,7 @@ class Chef def configure case @command when String,Array - @guard_interpreter = new_guard_interpreter(@parent_resource, @command, @command_opts, &@block) + @guard_interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, @command, @command_opts) @block = nil when nil # We should have a block if we get here @@ -122,17 +122,6 @@ class Chef "#{@positivity} { #code block }" end end - - private - - def new_guard_interpreter(parent_resource, command, opts) - if parent_resource.guard_interpreter == :default - guard_interpreter = Chef::GuardInterpreter::DefaultGuardInterpreter.new(command, opts) - else - guard_interpreter = Chef::GuardInterpreter::ResourceGuardInterpreter.new(parent_resource, command, opts) - end - end - end end end |