module Corefines::Symbol::Call

@!method call(*args, &block)

An useful extension for +&:symbol+ which makes it possible to pass
arguments for method in a block

@example
  [1, 2, 3].map(&:to_s.(2)) #=> ['1', '10', '11']
  %w[Chloe Drew Uma].map(&:gsub.('e', 'E')) #=> %w[ChloE DrEw Uma]

@param *args arguments being passed to the method.
@param block a block being passed to the method.
@return [Proc] a proc that invokes the method, identified by this
  symbol and passing it the given arguments, on an object passed to it.

Public Instance Methods

call(*args, &block) click to toggle source
# File lib/corefines/symbol.rb, line 22
def call(*args, &block)
  proc do |recv|
    recv.__send__(self, *args, &block)
  end
end