Class: Conditions::AnyCondition

Inherits:
BaseCondition show all
Defined in:
lib/conditions.rb

Overview

Checks if any values in the array are true

Instance Method Summary collapse

Methods inherited from BaseCondition

#initialize

Constructor Details

This class inherits a constructor from Conditions::BaseCondition

Instance Method Details

#apply(value) ⇒ true, false

Parameters:

  • value (Any, Array)

Returns:

  • (true)

    if value is truthy (or has at least one truthy value)

  • (false)

    if the value is not truthy (or has no truthy values)



70
71
72
73
# File 'lib/conditions.rb', line 70

def apply(value)
  value = [value] unless value.is_a? Array
  value.any?
end