Sha256: 717eac466da0959f17fc07daa2898df23d82a8d541fc5b9c0960e6ef48bfcf07
Contents?: true
Size: 303 Bytes
Versions: 2
Compression:
Stored size: 303 Bytes
Contents
class UnaryMinus < Arity1Operators Operator.register('-', UnaryMinus, 3) def to_sql operand = @operand.to_sql fail(ArgumentError, ("#{operand} is not a number")) if operand !~ /^\d+$/ -operand.to_i end def evaluate(attributes={}) -@operand.evaluate(attributes).to_i end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lamep-0.2.1 | lib/lamep/Expressions/unary_minus.rb |
lamep-0.2 | lib/lamep/Expressions/unary_minus.rb |