Class: Conditions::GreaterThanCondition

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

Overview

Checks if value is greater than a predicate

Instance Method Summary collapse

Constructor Details

#initialize(predicate) ⇒ GreaterThanCondition

Returns a new instance of GreaterThanCondition.

Raises:



164
165
166
167
168
# File 'lib/conditions.rb', line 164

def initialize(predicate)
  raise ConditionError, 'GreaterThan condition predicate must a number' unless predicate.is_a?(Numeric)

  super(predicate)
end

Instance Method Details

#apply(value) ⇒ true, false



174
175
176
# File 'lib/conditions.rb', line 174

def apply(value)
  value > @predicate
end