35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/arrow/table-loader.rb', line 35
def load
if @input.is_a?(URI)
custom_load_method_candidates = []
if @input.scheme
custom_load_method_candidates << "load_from_uri_#{@input.scheme}"
end
custom_load_method_candidates << "load_from_uri"
elsif @input.is_a?(String) and ::File.directory?(@input)
custom_load_method_candidates = ["load_from_directory"]
else
custom_load_method_candidates = ["load_from_file"]
end
custom_load_method_candidates.each do |custom_load_method|
next unless respond_to?(custom_load_method, true)
return __send__(custom_load_method)
end
available_schemes = []
(methods(true) | private_methods(true)).each do |name|
match_data = /\Aload_from_/.match(name.to_s)
if match_data
available_schemes << match_data.post_match
end
end
message = "Arrow::Table load source must be one of ["
message << available_schemes.join(", ")
message << "]: #{@input.inspect}"
raise ArgumentError, message
end
|