Sha256: 532cc81a60f5f3f5f14f8a89453f014f4ce938c4120cbca5a2304785df4b4160

Contents?: true

Size: 429 Bytes

Versions: 7

Compression:

Stored size: 429 Bytes

Contents

module Predicates
  private
  def is_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

7 entries across 7 versions & 1 rubygems

Version Path
totally_lazy-0.1.53 lib/totally_lazy/predicates.rb
totally_lazy-0.1.52 lib/totally_lazy/predicates.rb
totally_lazy-0.1.51 lib/totally_lazy/predicates.rb
totally_lazy-0.1.50 lib/totally_lazy/predicates.rb
totally_lazy-0.1.49 lib/totally_lazy/predicates.rb
totally_lazy-0.1.48 lib/totally_lazy/predicates.rb
totally_lazy-0.1.47 lib/totally_lazy/predicates.rb