Sha256: 915d00963fe6ae2659e7822f450160f2431f083f6783e7b30eafa5759484c1d3
Contents?: true
Size: 519 Bytes
Versions: 4
Compression:
Stored size: 519 Bytes
Contents
# -*- encoding : utf-8 -*- module LambdaDriver::WithArgs # Returns partially applied function that has 2nd and more parameters # fixed by given *args. # # f = lamdba{|x, y, z| [x, y, z]} # h = f.with_args(:a, :b) # h.(:c) # => [:c, :a, :b] # # This method is aliased as `*`. # # f * :foo # => f.with_args(:foo) # def with_args(*args) lambda{|v| self.to_proc.call(*([v] + args)) } end def self.included(klass) klass.send(:alias_method, :*, :with_args) end end
Version data entries
4 entries across 4 versions & 1 rubygems