class FlowEngine::Rules::GreaterThan
@attr_reader value [Integer] threshold
@attr_reader field [Symbol] answer key
Rule: the answer for the given field (coerced to integer) is greater than the threshold.
def evaluate(answers)
-
(Boolean)- true if answers[field].to_i > value
Parameters:
-
answers(Hash) -- current answers (field value is coerced with to_i)
def evaluate(answers) answers[field].to_i > value end
def initialize(field, value)
-
value(Integer) -- threshold -
field(Symbol) -- answer key
def initialize(field, value) super() @field = field @value = value freeze end
def to_s
-
(String)- e.g. "business_income > 100000"
def to_s "#{field} > #{value}" end