class LIVR::Rules::Numeric::MinNumber
Public Class Methods
new(min_number)
click to toggle source
# File lib/livr/rules/numeric.rb, line 88 def initialize(min_number) @min_number = min_number end
Public Instance Methods
call(value, user_data, field_results)
click to toggle source
# File lib/livr/rules/numeric.rb, line 92 def call(value, user_data, field_results) return if is_no_value(value) return 'FORMAT_ERROR' if !is_primitive(value) value = Float(value.to_s) rescue nil if value.nil? return "NOT_NUMBER" end if value < @min_number return "TOO_LOW" else field_results << value return end end