Sha256: dc21769bb70b784cb87c940d498825b61b3d5b76af639a97aa8a98ef74e49574

Contents?: true

Size: 249 Bytes

Versions: 5

Compression:

Stored size: 249 Bytes

Contents

module MPatch
  module Proc

    # sugar syntax for proc * operator
    #    a = ->(x){x+1}
    #    b = ->(x){x*10}
    #    c = b*a
    #    c.call(1) #=> 20
    def *(other)
      self.class.new { |*args| self[*other[*args]] }
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mpatch-2.2.1 lib/mpatch/proc.rb
mpatch-2.1.3 lib/mpatch/proc.rb
mpatch-2.1.0 lib/mpatch/proc.rb
mpatch-2.0.1 lib/mpatch/proc.rb
mpatch-2.0.0 lib/mpatch/proc.rb