Declare a Sass signature for a Ruby-defined function. This includes the names of the arguments, whether the function takes a variable number of arguments, and whether the function takes an arbitrary set of keyword arguments.
It’s not necessary to declare a signature for a function. However, without a signature it won’t support keyword arguments.
A single function can have multiple signatures declared as long as each one takes a different number of arguments. It’s also possible to declare multiple signatures that all take the same number of arguments, but none of them but the first will be used unless the user uses keyword arguments.
method_name (Symbol) —
The name of the method whose signature is being declared.
args (Array<Symbol>) —
The names of the arguments for the function signature.
options (Hash) (defaults to: {}) —
a customizable set of options
Options Hash (options):
:var_args (Boolean) — default: false —
Whether the function accepts a variable number of (unnamed) arguments in addition to the named arguments.
:var_kwargs (Boolean) — default: false —
Whether the function accepts other keyword arguments in addition to those in :args. If this is true, the Ruby function will be passed a hash from strings to Literals as the last argument. In addition, if this is true and :var_args is not, Sass will ensure that the last argument passed is a hash.
.declare
is not part of Ruby's standard library. It seems to exist in the Sass gem.It is declared in the Sass::Script::Functions module: here
Here is the relevant documentation: