class LIVR::Rules::String::MinLength
Public Class Methods
new(min_length)
click to toggle source
# File lib/livr/rules/string.rb, line 70 def initialize(min_length) @min_length = min_length end
Public Instance Methods
call(value, user_data, field_results)
click to toggle source
# File lib/livr/rules/string.rb, line 74 def call(value, user_data, field_results) return if is_no_value(value) return 'FORMAT_ERROR' unless is_primitive(value) if value.to_s.length < @min_length return 'TOO_SHORT' end field_results << value.to_s return end