class Spectator::Mocks::ArgumentsPattern(Positional, KeywordArguments)
- Spectator::Mocks::ArgumentsPattern(Positional, KeywordArguments)
- Spectator::Mocks::AbstractArgumentsPattern
- Reference
- Object
Overview
Arguments matched against to determine if a stub should be used or a call had expected arguments.
The Positional type parameter must be a Tuple
.
The KeywordArguments type parameter must be a NamedTuple
.
Defined in:
spectator/mocks/arguments_pattern.crConstructors
-
.new(positional : Positional, named : KeywordArguments)
Creates a pattern to match against arguments passed to a method.
Class Method Summary
-
.any : AbstractArgumentsPattern | Nil
Returns a value that matches against any and all arguments.
-
.build(*args, **named) : AbstractArgumentsPattern
Creates a pattern to match against arguments written as a normal parameter list.
-
.none : AbstractArgumentsPattern
Creates an empty set of arguments to match against.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#===(arguments : Arguments(Args, Splat, DoubleSplat)) : Bool forall Args, Splat, DoubleSplat
Checks if arguments passed to a method match those specified by this pattern.
-
#hash(hasher)
See
Object#hash(hasher)
-
#named : KeywordArguments
Keyword arguments.
-
#positional : Positional
Positional arguments.
-
#to_args : Arguments
Returns the arguments as-if they were passed to a method.
-
#to_s(io : IO) : Nil
Generates the string representation of the argument pattern.
Constructor Detail
Creates a pattern to match against arguments passed to a method.
Class Method Detail
Returns a value that matches against any and all arguments.
Creates a pattern to match against arguments written as a normal parameter list.
Creates an empty set of arguments to match against. Matching against this indicates no arguments were passed.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Checks if arguments passed to a method match those specified by this pattern.