From c410c7e3aca6073eeef050abd503064141da9d78 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 8 Nov 2020 10:41:57 -0800 Subject: Use ||= where we can Signed-off-by: Tim Smith --- chef-utils/lib/chef-utils/version_string.rb | 2 +- lib/chef/cookbook_version.rb | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/chef-utils/lib/chef-utils/version_string.rb b/chef-utils/lib/chef-utils/version_string.rb index 345f0ab03e..425fe5b050 100644 --- a/chef-utils/lib/chef-utils/version_string.rb +++ b/chef-utils/lib/chef-utils/version_string.rb @@ -28,7 +28,7 @@ module ChefUtils # # @param val [String] Version string to parse. def initialize(val) - val = "" unless val + val ||= "" super(val) begin @parsed_version = ::Gem::Version.create(self) diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb index 135a5292a6..5719fa6a13 100644 --- a/lib/chef/cookbook_version.rb +++ b/lib/chef/cookbook_version.rb @@ -587,9 +587,7 @@ class Chef end def file_vendor - unless @file_vendor - @file_vendor = Chef::Cookbook::FileVendor.create_from_manifest(cookbook_manifest) - end + @file_vendor ||= Chef::Cookbook::FileVendor.create_from_manifest(cookbook_manifest) @file_vendor end -- cgit v1.2.1