module Procto::ClassMethods
Procto
module for adding .to_proc to host class
Public Instance Methods
to_proc()
click to toggle source
Return the ‘call` singleton method as a lambda
@example using a class as a proc
class Shouter include Procto.call def initialize(text) @text = text end def call "#{@text.upcase}!" end end Shouter.to_proc.call('hello') # => "HELLO!" %w[foo bar].map(&Shouter) # => ["FOO!", "BAR!"]
@return [Proc]
@api public
# File lib/procto.rb, line 107 def to_proc public_method(:call).to_proc end