Module: TSpec
- Defined in:
- lib/tspec.rb,
lib/tspec.rb
Defined Under Namespace
Classes: ArgumentTypeError, NotFoundArgumentNameError, ReturnValueTypeError
Class Method Summary collapse
Class Method Details
.value_type_check(value, *types) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tspec.rb', line 28 def self.value_type_check(value, *types) types.any? do |type| if type.instance_of?(Array) return false unless value.instance_of?(Array) value.all? do |v| type.any? do |t| value_type_check(v, t) end end else value.instance_of?(type) end end end |