Sha256: 84fce07ac442fe0c8fd01a53d15eff8e8b1eefb24a7dfae4d466772af2013a70
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
module Xpect class Type def self.process_array(iterable, data, path) iterable.map.with_index do |spc, idx| Type.process(spc, spc, data[idx], path) end end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xpect-0.1.0 | lib/xpect/type.rb |