class Spectator::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:

spectator/mocks/arguments.cr

Constructors

Class Method Summary

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(args : Args, splat_name : Symbol | Nil, splat : Splat, kwargs : DoubleSplat) #

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


[View source]

Class Method Detail

def self.none : AbstractArguments #

Creates an empty set of arguments.


[View source]

Macro Detail

macro capture #

Creates arguments from the ones passed to the containing method.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

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


def [](index : Int) #

Retrieves the positional argument at the specified index.


[View source]
def [](arg : Symbol) #

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


[View source]
def args : Args #

Named tuple containing the positional arguments in order.


[View source]
def empty? #

Indicates no arguments were passed.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def kwargs : DoubleSplat #

Named tuple containing the additional keyword arguments.


[View source]
def named : NamedTuple #

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


[View source]
def positional : Tuple #

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


[View source]
def splat : Splat #

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


[View source]
def splat_name : Symbol | Nil #

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


[View source]
def to_s(io : IO) : Nil #

Generates the string representation of the arguments.


[View source]