class Conditions::NotCondition

Checks if a condition is not true

Public Class Methods

new(predicate) click to toggle source

@param [Hash] predicate A hash representing a condition

Calls superclass method Conditions::BaseCondition::new
# File lib/conditions.rb, line 123
def initialize(predicate)
  raise ConditionError, 'Not condition predicate a condition' unless predicate.is_a?(Hash) && predicate.key?('class')

  predicate = Object.const_get("Conditions::#{predicate['class']}").new(predicate['predicate'])
  super(predicate)
end

Public Instance Methods

apply(value) click to toggle source

@param [Any] value @return [true] if value does not satisfy the condition @return [false] if value satisfies the condition

# File lib/conditions.rb, line 134
def apply(value)
  !@predicate.apply(value)
end