class Mocks::Arguments(Args, Splat, DoubleSplat)
Overview
Stores arguments passed by a method call.
Args must be a NamedTuple
type representing the standard arguments.
Splat must be a Tuple
type representing the extra positional arguments.
DoubleSplat must be a NamedTuple
type representing extra keyword arguments.
Defined in:
mocks/arguments.crConstructors
-
.new(args : Args, splat_name : Symbol | Nil, splat : Splat, kwargs : DoubleSplat)
Creates arguments as they would be available when passed to a method.
Class Method Summary
-
.none : AbstractArguments
Creates an empty set of arguments.
Macro Summary
-
capture
Creates arguments from the ones passed to the containing method.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#[](index : Int)
Retrieves the positional argument at the specified index.
-
#[](arg : Symbol)
Retrieves a positional, non-splat argument or keyword argument by the specified name.
-
#args : Args
Named tuple containing the positional arguments in order.
-
#empty?
Indicates no arguments were passed.
-
#hash(hasher)
See
Object#hash(hasher)
-
#kwargs : DoubleSplat
Named tuple containing the additional keyword arguments.
-
#named : NamedTuple
Retrieves the positional, non-splat arguments and additional keyword arguments.
-
#positional : Tuple
Retrieves all positional arguments, including the spat arguments, in the order they were passed.
-
#splat : Splat
Tuple containing the extra arguments captured by a splat.
-
#splat_name : Symbol | Nil
Name of the splat argument, if one was provided.
-
#to_s(io : IO) : Nil
Generates the string representation of the arguments.
Constructor Detail
Creates arguments as they would be available when passed to a method.
Class Method Detail
Macro Detail
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Retrieves a positional, non-splat argument or keyword argument by the specified name.
Retrieves the positional, non-splat arguments and additional keyword arguments.
Retrieves all positional arguments, including the spat arguments, in the order they were passed.
Tuple containing the extra arguments captured by a splat. Will be nil if there was no splat argument.
Name of the splat argument, if one was provided. Will be nil if there was no splat argument.