module DeepDouble
Takes a Hash of stubbed values to create a fake method. The stubbed values map lists of arguments (represented as arrays, with the empty array representing a method that takes no args) to return values.
Validates that the structure of a stubbed values Hash is valid:
-
It must be a Hash
-
It's keys must be Arrays or the special value “:default”
Because a Hash in the context of a DeepDouble
definition is considered to be the definition of a nested DeepDouble
, we need a way to “escape” a Hash for methods that actually return Hash values.
Likewise, a Proc in the context of a DeepDouble
definition is invoked automatically. (This lets us, eg, create methods that raise errors.) Again, we need a way to “escape” a Proc for methods that actually return literal Proc values.
This class provides a general mechanism to “escape” special values in Function definitions.
Makes a `DeepDouble::FakeMethod` recursive, so that `Hash` results are automatically converted to `DeepDouble` instances in their own right.
Constants
- VERSION