class

Mocks::Arguments(Args, Splat, DoubleSplat)

Inherits Mocks::AbstractArguments < Reference < Object

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.

Constructors

new(args : Args, splat_name : Symbol | Nil, splat : Splat, kwargs : DoubleSplat)

Creates arguments as they would be available when passed to a method.

Source

Class methods

none

Creates an empty set of arguments.

Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

[](index : Int)

Retrieves the positional argument at the specified index.

Source
[](arg : Symbol)

Retrieves a positional, non-splat argument or keyword argument by the specified name.

Source
args

Named tuple containing the positional arguments in order.

Source
empty?

Indicates no arguments were passed.

Source
hash(hasher)

See Object#hash(hasher)

kwargs

Named tuple containing the additional keyword arguments.

Source
named

Retrieves the positional, non-splat arguments and additional keyword arguments.

Source
positional

Retrieves all positional arguments, including the spat arguments, in the order they were passed.

Source
splat

Tuple containing the extra arguments captured by a splat. Will be nil if there was no splat argument.

Source
splat_name

Name of the splat argument, if one was provided. Will be nil if there was no splat argument.

Source
to_s(io : IO) : Nil

Generates the string representation of the arguments.

Source

Macros

capture

Creates arguments from the ones passed to the containing method.

Source