62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/types/types/simple.rb', line 62
def self.type_for_module(mod)
cached = @cache[mod]
return cached if cached
type = if mod == ::Array
T::Array[T.untyped]
elsif mod == ::Hash
T::Hash[T.untyped, T.untyped]
elsif mod == ::Enumerable
T::Enumerable[T.untyped]
elsif mod == ::Enumerator
T::Enumerator[T.untyped]
elsif mod == ::Range
T::Range[T.untyped]
elsif !Object.autoload?(:Set) && Object.const_defined?(:Set) && mod == ::Set
T::Set[T.untyped]
else
Simple.new(mod)
end
@cache[mod] = type unless mod.frozen?
type
end
|