Sha256: 7e8fc445f5042a487b7315cac0b54ee3cfe9a4f6644ee1aa3773bc0e2fc290cd

Contents?: true

Size: 320 Bytes

Versions: 6

Compression:

Stored size: 320 Bytes

Contents

# frozen_string_literal: true

module Clowne
  module Ext
    # Add to_proc method for lambda
    module LambdaAsProc
      refine Proc do
        def to_proc
          return self unless lambda?

          this = self
          proc { |*args| this.call(*args.take(this.arity)) }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clowne-1.5.0 lib/clowne/ext/lambda_as_proc.rb
clowne-1.4.0 lib/clowne/ext/lambda_as_proc.rb
clowne-1.3.0 lib/clowne/ext/lambda_as_proc.rb
clowne-1.2.0 lib/clowne/ext/lambda_as_proc.rb
clowne-1.1.0 lib/clowne/ext/lambda_as_proc.rb
clowne-1.0.0 lib/clowne/ext/lambda_as_proc.rb