Sha256: cf0a93a0e5170c93495ed7550abe9fba7ae7feb581ee743ceca9d0ecc01cc9f4
Contents?: true
Size: 506 Bytes
Versions: 1
Compression:
Stored size: 506 Bytes
Contents
require 'invokable/version' # TODO: Add curry, memoize, transducers? module Invokable # If object responds to `call` convert into a Proc forwards it's arguments along to `call`. # # @return [Proc] def to_proc if respond_to?(:call) # TODO: Would method(:call) be more performant? We need benchmarks. Proc.new do |*args| call(*args) end else raise "Don't know how to convert #{self.inspect} into a Proc" end end def curry to_proc.curry end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
invokable-0.2.0 | lib/invokable.rb |