class Data::Criteria::NumericComparisonMatcher
Constants
- REGEXP
Public Class Methods
new(expected)
click to toggle source
# File lib/data/criteria/matcher.rb, line 35 def initialize(expected) raise "unsupported format" unless m = REGEXP.match(expected) @expected_string = expected @op = m[1] @expected = BigDecimal(m[2]) end
Public Instance Methods
call(actual)
click to toggle source
# File lib/data/criteria/matcher.rb, line 42 def call(actual) case actual when String actual == @expected_string when Numeric actual.send(@op.to_sym, @expected) else raise "actual=#{actual}(#{actual.class}) is unsupported" end end