End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Proc#parameters
prc.parameters → array
proc.c
View on GitHub ↗
static VALUE
rb_proc_parameters(VALUE self)
{
int is_proc;
const rb_iseq_t *iseq = rb_proc_get_iseq(self, &is_proc);
if (!iseq) {
return rb_unnamed_parameters(rb_proc_arity(self));
}
return rb_iseq_parameters(iseq, is_proc);
}
Returns the parameter information of this proc.
Example
prc = lambda{|x, y=42, *other|} prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
See also
#lambda?
#ruby2_keywords
#inspect
#source_location
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1