lib/mayl/loader.rb in mayl-0.0.1 vs lib/mayl/loader.rb in mayl-0.1.0

- old
+ new

@@ -15,11 +15,15 @@ # # path - The path under which to scan for YAML files. # # Returns an Array of Locale objects. def self.load(path) - Dir[File.expand_path(path) << "/*.yml"].map { |filename| + locales = Dir[File.expand_path(path) << "/*.yml"].map { |filename| Locale.new filename, YAML.load(File.read(filename)) } + + abort "Error: No locales found under ./#{path}" if locales.empty? + + locales end end end