summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-08 10:41:57 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-08 10:41:57 -0800
commitc410c7e3aca6073eeef050abd503064141da9d78 (patch)
tree133e5379a9213424b58c0989b5e6bb5756686b6e
parentd6ffd5b44a04ff32e9049ed8c04bf4dad38e5b7e (diff)
downloadchef-or_equal.tar.gz
Use ||= where we canor_equal
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--chef-utils/lib/chef-utils/version_string.rb2
-rw-r--r--lib/chef/cookbook_version.rb4
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