Sha256: 78c8c4353d71b7f44f7c887a1f1720221770cedeb82810d5af126820ddfcfd14

Contents?: true

Size: 258 Bytes

Versions: 2

Compression:

Stored size: 258 Bytes

Contents

module MPatch::Include
  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

2 entries across 2 versions & 1 rubygems

Version Path
mpatch-2.3.0 lib/mpatch/proc.rb
mpatch-2.2.4 lib/mpatch/proc.rb