Sha256: 66507ad49d3d1d7d0ac1ad10ff6345f8ebb557a2a5bf85de45b5bd37ac00c354

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

module Predicates
  private
  def _not(pred)
    -> (bool) { !pred.(bool) }
  end

  def is_left
    -> (either) { either.is_left? }
  end

  def is_right
    -> (either) { either.is_right? }
  end

  def matches(regex)
    ->(value) { !regex.match(value).nil? }
  end

  def equal_to?(that)
    ->(this) { this == that }
  end
  alias is equal_to?

  def where(fn, predicate)
    ->(value) { predicate.(fn.(value)) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
totally_lazy-0.1.46 lib/totally_lazy/predicates.rb