Module: DR::CoreExt::UnboundMethod

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

Instance Method Summary collapse

Instance Method Details

#call(*args, &b) ⇒ Object



233
234
235
# File 'lib/dr/ruby_ext/core_modules.rb', line 233

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



228
229
230
231
232
# File 'lib/dr/ruby_ext/core_modules.rb', line 228

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