Raise an error if paths isn't an array or hash

This commit is contained in:
Joshua Peek
2011-05-27 12:11:48 -05:00
parent 0b07d14a98
commit 3d7c9ab1ed

View File

@@ -20,13 +20,16 @@ module Linguist
#
# Returns a Repository
def initialize(paths)
if paths.is_a?(Array)
case paths
when Array
@paths = paths.inject({}) do |h, blob|
h[blob.name] = blob
h
end
else
when Hash
@paths = paths
else
raise ArgumentError, "#{paths.class} is not an Array or Hash"
end
@computed_stats = false