Method: Chef::Resource::Conditional#initialize
- Defined in:
- lib/chef/resource/conditional.rb
#initialize(positivity, command = nil, command_opts = {}, &block) ⇒ Conditional
Returns a new instance of Conditional.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/chef/resource/conditional.rb', line 45 def initialize(positivity, command=nil, command_opts={}, &block) @positivity = positivity case command when String @command, @command_opts = command, command_opts @block = nil when nil raise ArgumentError, "only_if/not_if requires either a command or a block" unless block_given? @command, @command_opts = nil, nil @block = block else raise ArgumentError, "Invalid only_if/not_if command: #{command.inspect} (#{command.class})" end end |