9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/xpect/type.rb', line 9
def self.process(case_item, spec, val, path)
case case_item
when Xpect::Every
case_item.conform!(data: val, path: path)
when Array
unless val.is_a?(Array)
raise(FailedSpec, "'#{ val }' must be an array")
end
Type.process_array(spec, val, path)
when Hash
Xpect::Spect.conform!(spec: spec, data: val, path: path)
when Xpect::Pred, Xpect::Keys
spec.conform!(value: val, path: path)
when Proc
Xpect::EqualityHelpers.equal_with_proc?(spec, val, path)
val
else
Xpect::EqualityHelpers.equal?(spec, val, path)
val
end
end
|