summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-02-29 13:36:07 +0000
committerThom May <thom@chef.io>2016-02-29 13:36:07 +0000
commit5d34b51c990639c57fe8a47141a0eef79ea775e5 (patch)
tree2d39318918b326ac84c37b70ffe178dd01a0bf67
parentbe1438e82d3fc6dfd85eaf24402283dec765de32 (diff)
downloadchef-tm/file_dirname.tar.gz
use File.basename rather than reimplementingtm/file_dirname
-rw-r--r--lib/chef/chef_fs/data_handler/data_handler_base.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/chef/chef_fs/data_handler/data_handler_base.rb b/lib/chef/chef_fs/data_handler/data_handler_base.rb
index 83f56ed16d..62b35d69d4 100644
--- a/lib/chef/chef_fs/data_handler/data_handler_base.rb
+++ b/lib/chef/chef_fs/data_handler/data_handler_base.rb
@@ -28,10 +28,7 @@ class Chef
# Takes a name like blah.json and removes the .json from it.
#
def remove_dot_json(name)
- if name.length < 5 || name[-5, 5] != ".json"
- raise "Invalid name #{path}: must end in .json"
- end
- name[0, name.length - 5]
+ File.basename(name, ".json")
end
#