summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-05 12:03:20 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-05 12:57:40 -0700
commit8215091264d67d81f0da9a13f968b864ff736cb2 (patch)
tree37b71de99d1190c9c24e63fbbc50610363b7b8d5 /lib/chef/knife
parent7bf98ad06b30b7feb4ea3fbbe45a5b733467a5d3 (diff)
downloadchef-8215091264d67d81f0da9a13f968b864ff736cb2.tar.gz
Style/ClassCheck
convert kind_of? to is_a? Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/core/generic_presenter.rb2
-rw-r--r--lib/chef/knife/core/node_presenter.rb4
-rw-r--r--lib/chef/knife/core/text_formatter.rb8
-rw-r--r--lib/chef/knife/supermarket_share.rb2
4 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index 6ee0d1ea06..e219e29707 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -201,7 +201,7 @@ class Chef
end
end
# necessary (?) for coercing objects (the run_list object?) to hashes
- ( !data.kind_of?(Array) && data.respond_to?(:to_hash) ) ? data.to_hash : data
+ ( !data.is_a?(Array) && data.respond_to?(:to_hash) ) ? data.to_hash : data
end
def format_cookbook_list_for_display(item)
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index a77e9d7a65..3f1feb9d16 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -61,7 +61,7 @@ class Chef
end
def summarize_json(data)
- if data.kind_of?(Chef::Node)
+ if data.is_a?(Chef::Node)
node = data
result = {}
@@ -92,7 +92,7 @@ class Chef
# the volume of output is adjusted accordingly. Uses colors if enabled
# in the ui object.
def summarize(data)
- if data.kind_of?(Chef::Node)
+ if data.is_a?(Chef::Node)
node = data
# special case ec2 with their split horizon whatsis.
ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress]
diff --git a/lib/chef/knife/core/text_formatter.rb b/lib/chef/knife/core/text_formatter.rb
index 8775e2e76f..e0df395545 100644
--- a/lib/chef/knife/core/text_formatter.rb
+++ b/lib/chef/knife/core/text_formatter.rb
@@ -28,7 +28,7 @@ class Chef
@ui = ui
@data = if data.respond_to?(:display_hash)
data.display_hash
- elsif data.kind_of?(Array)
+ elsif data.is_a?(Array)
data
elsif data.respond_to?(:to_hash)
data.to_hash
@@ -48,7 +48,7 @@ class Chef
justify_width = data.keys.map { |k| k.to_s.size }.max.to_i + 1
data.sort.each do |key, value|
# key: ['value'] should be printed as key: value
- if value.kind_of?(Array) && value.size == 1 && is_singleton(value[0])
+ if value.is_a?(Array) && value.size == 1 && is_singleton(value[0])
value = value[0]
end
if is_singleton(value)
@@ -62,7 +62,7 @@ class Chef
lines.each { |line| buffer << " #{line}\n" }
end
end
- elsif data.kind_of?(Array)
+ elsif data.is_a?(Array)
data.each_index do |index|
item = data[index]
buffer << text_format(data[index])
@@ -77,7 +77,7 @@ class Chef
end
def is_singleton(value)
- !(value.kind_of?(Array) || value.respond_to?(:keys))
+ !(value.is_a?(Array) || value.respond_to?(:keys))
end
end
end
diff --git a/lib/chef/knife/supermarket_share.rb b/lib/chef/knife/supermarket_share.rb
index 51e8d3dbe5..f178b4ab35 100644
--- a/lib/chef/knife/supermarket_share.rb
+++ b/lib/chef/knife/supermarket_share.rb
@@ -113,7 +113,7 @@ class Chef
data = noauth_rest.get("#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}")
data["category"]
rescue => e
- return "Other" if e.kind_of?(Net::HTTPClientException) && e.response.code == "404"
+ return "Other" if e.is_a?(Net::HTTPClientException) && e.response.code == "404"
ui.fatal("Unable to reach Supermarket: #{e.message}. Increase log verbosity (-VV) for more information.")
Chef::Log.trace("\n#{e.backtrace.join("\n")}")