I have a hash:
rule => {
:quantity => 2,
:operator => ">="
}
and
@quantity = 1
Using @quantity
, rule[:operator]
, and rule[:quantity]
, I want to dynamically express:
if @quantity rule[:operator] rule[:quantity] # SyntaxError
such that it evaluates as:
if 1 >= 2
How can I do that?