module Gemmy::Patches::MethodPatch::InstanceMethods::Bind
Bind
an argument to a method. Very useful for the proc shorthand. For example say there's a method “def add(a,b); print a + b; end” You can run it for each number in a list:
[1,2,3].each &method(:add).bind(1) => 234
Public Instance Methods
bind(*args)
click to toggle source
# File lib/gemmy/patches/method_patch.rb, line 18 def bind *args Proc.new do |*more| self.call *(args + more) end end