Skip to content

Commit e8a34bf

Browse files
author
Sumit Jamgade
committed
hound fixes and refactor
1 parent 319518b commit e8a34bf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

chef/cookbooks/barclamp/libraries/barclamp_library.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,17 +444,17 @@ def last_two_configs(group, barclamp, instance)
444444

445445
def loadattr(hash, attrlist)
446446
i = 0
447-
return hash unless attrlist.length > 0
447+
return hash if attrlist.empty?
448448
while hash.respond_to?(:[])
449-
unless hash.has_key?(attrlist[i])
450-
Chef::Log.debug("[smart] hash is missing #{attrlist[i]}")
451-
return nil
449+
unless hash.key?(attrlist[i])
450+
Chef::Log.debug("[smart] hash is missing #{attrlist[i]}")
451+
return nil
452452
end
453453
hash = hash[attrlist[i]]
454454
i += 1
455455
if attrlist.length == i
456-
# Chef::Log.debug("[smart] loadattr return #{hash}")
457-
return hash
456+
# Chef::Log.debug("[smart] loadattr return #{hash}")
457+
return hash
458458
end
459459
end
460460
Chef::Log.debug("[smart] hash does not respond to []")

0 commit comments

Comments
 (0)