diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-04 11:13:26 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-04 11:13:26 -0800 |
commit | 6ec521c0b86c266b9dd5d17a6060139dab404c3b (patch) | |
tree | a27bf7a007bfeebd64258c2e5652f6da37b73efc /lib/chef/mixin | |
parent | ee53ee1aba16ee2ad7c1fdde18869af971dcba67 (diff) | |
parent | 4fd88f1f3c7d847712e61abab2bac6cb4a987265 (diff) | |
download | chef-6ec521c0b86c266b9dd5d17a6060139dab404c3b.tar.gz |
Merge pull request #4617 from chef/lcg/chefstyle-perf
Autofixing new Perf cops in 0.37.2
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r-- | lib/chef/mixin/command.rb | 5 | ||||
-rw-r--r-- | lib/chef/mixin/properties.rb | 3 | ||||
-rw-r--r-- | lib/chef/mixin/provides.rb | 3 | ||||
-rw-r--r-- | lib/chef/mixin/why_run.rb | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/lib/chef/mixin/command.rb b/lib/chef/mixin/command.rb index 257ed11221..0cc3143ec7 100644 --- a/lib/chef/mixin/command.rb +++ b/lib/chef/mixin/command.rb @@ -177,13 +177,14 @@ class Chef # module_function :popen4 - def chdir_or_tmpdir(dir, &block) + # FIXME: yard with @yield + def chdir_or_tmpdir(dir) dir ||= Dir.tmpdir unless File.directory?(dir) raise Chef::Exceptions::Exec, "#{dir} does not exist or is not a directory" end Dir.chdir(dir) do - block.call + yield end end diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb index 2e33d2d0e7..1ee16b8b4a 100644 --- a/lib/chef/mixin/properties.rb +++ b/lib/chef/mixin/properties.rb @@ -98,7 +98,8 @@ class Chef options.each { |k, v| options[k.to_sym] = v if k.is_a?(String) } options[:instance_variable_name] = :"@#{name}" if !options.has_key?(:instance_variable_name) - options.merge!(name: name, declared_in: self) + options[:name] = name + options[:declared_in] = self if type == NOT_PASSED # If a type is not passed, the property derives from the diff --git a/lib/chef/mixin/provides.rb b/lib/chef/mixin/provides.rb index 34a078c010..43a726de8c 100644 --- a/lib/chef/mixin/provides.rb +++ b/lib/chef/mixin/provides.rb @@ -7,12 +7,13 @@ class Chef # TODO no longer needed, remove or deprecate? include Chef::Mixin::DescendantsTracker - def provides(short_name, opts = {}, &block) + def provides(short_name, opts = {}) raise NotImplementedError, :provides end # Check whether this resource provides the resource_name DSL for the given # node. TODO remove this when we stop checking unregistered things. + # FIXME: yard with @yield def provides?(node, resource) raise NotImplementedError, :provides? end diff --git a/lib/chef/mixin/why_run.rb b/lib/chef/mixin/why_run.rb index b2aa5949c0..69fee58e31 100644 --- a/lib/chef/mixin/why_run.rb +++ b/lib/chef/mixin/why_run.rb @@ -49,7 +49,7 @@ class Chef def add_action(descriptions, &block) @actions << [descriptions, block] if (@resource.respond_to?(:is_guard_interpreter) && @resource.is_guard_interpreter) || !Chef::Config[:why_run] - block.call + yield end events.resource_update_applied(@resource, @action, descriptions) end |