mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Raise an error if paths isn't an array or hash
This commit is contained in:
@@ -20,13 +20,16 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Returns a Repository
|
# Returns a Repository
|
||||||
def initialize(paths)
|
def initialize(paths)
|
||||||
if paths.is_a?(Array)
|
case paths
|
||||||
|
when Array
|
||||||
@paths = paths.inject({}) do |h, blob|
|
@paths = paths.inject({}) do |h, blob|
|
||||||
h[blob.name] = blob
|
h[blob.name] = blob
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
else
|
when Hash
|
||||||
@paths = paths
|
@paths = paths
|
||||||
|
else
|
||||||
|
raise ArgumentError, "#{paths.class} is not an Array or Hash"
|
||||||
end
|
end
|
||||||
|
|
||||||
@computed_stats = false
|
@computed_stats = false
|
||||||
|
|||||||
Reference in New Issue
Block a user