Module: TSpec
- Defined in:
- lib/tspec.rb,
lib/tspec/type_error.rb
Defined Under Namespace
Classes: ArgumentTypeError, NotFoundArgumentNameError, ReturnValueTypeError
Constant Summary collapse
- DEFINE_METHOD_SYMBOLS =
%i(method_added singleton_method_added define_method instance_method method)
Class Method Summary collapse
Class Method Details
.value_type_check(value, *types) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tspec.rb', line 40 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 |