Class Multimethod::Signature
In: lib/multimethod/signature.rb
Parent: Object

Represents a method signature.

A Signature has a bound Module, a name and a Parameter list.

Each Parameter contributes to the scoring of the Method based on the message argument types, including the message receiver.

Methods

Included Modules

Comparable

Attributes

class_method  [RW]  True if the signature is bound to the class.
default  [RW]  An Array of all Parameters with a default value. Will be nil if there is not a Parameter with a default values.
file  [RW]  The file where this Signature is specified.
line  [RW]  The line in the file where this Signature is specified.
max_args  [RW]  The maximum # of arguments for this signature. May be nil, if this Signature accepts restargs.
min_args  [RW]  The minimum # of arguments for this signature.
mod  [RW]  The Module that the Signature is bound to.
name  [RW]  The name of the method.
parameter  [RW]  The list of Parameters, self is included at position 0.
restarg  [RW]  The "*args" parameter or nil.
verbose  [RW]  Defines level of verbosity during processing.

Public Class methods

Initialize a new Signature.

Public Instance methods

Compares two Signature objects.

Add the implicit "self" parameter at the front of the Parameter list.

Returns the bound Module.

Returns the Parameter at argument position i. If the Signature has a restarg, it will be used for argument postitions past the end of the Parameter list.

Returns a String representing this Signature’s Parameters.

Scan a programmatic Parameter list:

  [ A, :a, B, :b, :c, '*d' ]

Scan the parameter string of a Signature:

  "A a, x = true, *restargs"

Scan a string as a Signature, e.g.: "def foo(A a, x = true, *restargs)"

Score of this Signature based on the argument types.

The score is an Array of values that when sorted against other Signature scores will place the best matching Signature at the top of the list.

Score of this Signature using a cache.

Returns a String representing this Signature’s definition parameters in Ruby syntax.

Returns a String representing this Signature’s definition in Ruby syntax.

Returns a String representing this Signature’s definition in Ruby Doc syntax.

Returns a String representing this Signature.

[Validate]