Sha256: e971b3814c23de311b137cc0671734e1f948a681c9f0bd4fdcf9f2715ed316a3

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

# -*- encoding : utf-8 -*-

# Override Proc#>> and << these are implemented from Ruby 2.6
# to ensure passed argument is callable.
# Convert argument to proc obj by calling :to_proc before call super implementaion
module ProcOverride
  def compose(g)
    self << g
  end

  # g compose self
  def <<(g)
    super(g.to_proc)
  end

  # g compose self
  def >>(g)
    g.to_proc << self
  end
end

class Proc
  include LambdaDriver::Callable
  include LambdaDriver::WithArgs
  include LambdaDriver::Flipable
  include LambdaDriver::ProcConvertable
  include LambdaDriver::Currying
  include LambdaDriver::Liftable

  if RUBY_VERSION < "2.6.0"
    include LambdaDriver::Composable
  else
    prepend ProcOverride
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lambda_driver-1.3.0 lib/lambda_driver/core_ext/proc.rb