Document and test MethodCall

This commit is contained in:
Michael Miller 2022-03-05 16:15:42 -07:00
parent 13f185b801
commit ced98778a4
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
2 changed files with 31 additions and 0 deletions

View file

@ -2,14 +2,19 @@ require "./abstract_arguments"
require "./arguments"
module Spectator
# Stores information about a call to a method.
class MethodCall
# Name of the method.
getter method : Symbol
# Arguments passed to the method.
getter arguments : AbstractArguments
# Creates a method call.
def initialize(@method : Symbol, @arguments : Arguments = Arguments.empty)
end
# Creates a method call by splatting its arguments.
def self.capture(method : Symbol, *args, **kwargs)
arguments = Arguments.new(args, kwargs)
new(method, arguments)