Module: TrickBag::Functional

Defined in:
lib/trick_bag/functional/functional.rb

Class Method Summary collapse

Class Method Details

.all_with_object?(conditions, object) ⇒ Boolean

Returns whether or not all of the condition lambdas return true when passed the specified object

Returns:

  • (Boolean)


19
20
21
# File 'lib/trick_bag/functional/functional.rb', line 19

def all_with_object?(conditions, object)
  conditions.all? { |condition| condition.(object) }
end

.any_with_object?(conditions, object) ⇒ Boolean

Returns whether or not any of the condition lambdas return true when passed the specified object

Returns:

  • (Boolean)


26
27
28
# File 'lib/trick_bag/functional/functional.rb', line 26

def any_with_object?(conditions, object)
  conditions.any? { |condition| condition.(object) }
end

.none_with_object?(conditions, object) ⇒ Boolean

Returns whether or not none of the condition lambdas return true when passed the specified object

Returns:

  • (Boolean)


12
13
14
# File 'lib/trick_bag/functional/functional.rb', line 12

def none_with_object?(conditions, object)
  conditions.none? { |condition| condition.(object) }
end