lib/tap/support/configurable_class.rb in bahuvrihi-tap-0.10.5 vs lib/tap/support/configurable_class.rb in bahuvrihi-tap-0.10.6
- old
+ new
@@ -86,11 +86,11 @@
end
# Loads the contents of path as YAML. Returns an empty hash if the path
# is empty, does not exist, or is not a file.
def load_config(path)
- return {} if path == nil || !File.file?(path)
-
+ # the last check prevents YAML from auto-loading itself for empty files
+ return {} if path == nil || !File.file?(path) || File.size(path) == 0
YAML.load_file(path) || {}
end
protected
\ No newline at end of file