class LIVR::Rules::Numeric::PositiveInteger
Public Instance Methods
call(value, user_data, field_results)
click to toggle source
# File lib/livr/rules/numeric.rb, line 22 def call(value, user_data, field_results) return if is_no_value(value) return 'FORMAT_ERROR' if !is_primitive(value) value_int = Integer(value.to_s) rescue nil return "NOT_POSITIVE_INTEGER" if value_int.nil? return "NOT_POSITIVE_INTEGER" unless value_int.positive? field_results << value_int return end