Module: DR::CoreExt::UnboundMethod

Defined in:
lib/dr/ruby_ext/core_modules.rb

Instance Method Summary collapse

Instance Method Details

#call(*args, &b) ⇒ Object



152
153
154
# File 'lib/dr/ruby_ext/core_modules.rb', line 152

def call(*args,&b)
  to_proc.call(*args,&b)
end

#to_procObject

this should be in the stdlib... Note: this is similar to Symbol#to_proc which works like this: foo=:foo.to_proc; foo.call(obj,*args) #=> obj.method(:foo).call(*args) => :length.to_proc.call("foo") #=> 3



147
148
149
150
151
# File 'lib/dr/ruby_ext/core_modules.rb', line 147

def to_proc
  return lambda do |obj,*args,&b|
    bind(obj).call(*args,&b)
  end
end