class Spectator::FormalArguments(Args, Splat, DoubleSplat)

Overview

Arguments passed into a method.

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/formal_arguments.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Spectator::AbstractArguments

inspect(io : IO) : Nil inspect

Instance methods inherited from class Object

should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should
, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not

Constructor Detail

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

Creates arguments used in a method call.


[View source]
def self.new(args : Args, kwargs : DoubleSplat) #

Creates arguments used in a method call.


[View source]

Class Method Detail

def self.build(args : NamedTuple, splat_name : Symbol, splat : Tuple, kwargs = NamedTuple.new) #

Captures arguments passed to a call.


[View source]
def self.build(args = NamedTuple.new, kwargs = NamedTuple.new) #

Captures arguments passed to a call.


[View source]
def self.none : AbstractArguments #

Instance of empty arguments.


[View source]

Instance Method Detail

def ==(other : AbstractArguments) #

Checks if this set of arguments and another are equal.


[View source]
def ===(other : Arguments) #

Checks if another set of arguments matches this set of arguments.


[View source]
def ===(other : FormalArguments) #

Checks if another set of arguments matches this set of arguments.


[View source]
def [](index : Int) #

Returns the positional argument at the specified index.


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

Returns the specified named argument.


[View source]
def args : Args #

Positional arguments.


[View source]
def kwargs : DoubleSplat #

Keyword arguments.


[View source]
def named : NamedTuple #

Returns all named positional and keyword arguments as a named tuple.


[View source]
def positional : Tuple #

Returns all arguments and splatted arguments as a tuple.


[View source]
def splat : Splat #

Additional positional arguments.


[View source]
def splat_name : Symbol | Nil #

Name of the splat argument, if used.


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

Constructs a string representation of the arguments.


[View source]