Skip to content
instance method

Method#===

(?) -> untyped
method === obj → result_of_method

Alias of #call

Invokes the meth with the specified arguments, returning the method’s return value.

Example
m = 12.method("+")
m.call(3)    #=> 15
m.call(20)   #=> 32

Using Method#=== allows a method object to be the target of a when clause in a case statement.

Example
require 'prime'

case 1373
when Prime.method(:prime?)
  # ...
end
See also #call #== #>> #<< also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0