lib/eye/checker.rb in reel-eye-0.5.1 vs lib/eye/checker.rb in reel-eye-0.5.2
- old
+ new
@@ -129,11 +129,11 @@
def get_value_safe
get_value
end
def get_value
- raise 'Realize me'
+ raise NotImplementedError
end
def human_value(value)
value.to_s
end
@@ -216,8 +216,31 @@
class CustomDefer < Defer
def self.inherited(base)
super
register(base)
+ end
+ end
+
+ class Measure < Eye::Checker
+ param :below, [Fixnum, Float]
+ param :above, [Fixnum, Float]
+
+ def good?(value)
+ return false if below && (value > below)
+ return false if above && (value < above)
+ true
+ end
+
+ def measure_str
+ if below && above
+ ">#{human_value(above)}<#{human_value(below)}"
+ elsif below
+ "<#{human_value(below)}"
+ elsif above
+ ">#{human_value(above)}"
+ else
+ '-'
+ end
end
end
end