1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/validators/good_text_validator.rb

13 lines
292 B
Ruby
Raw Normal View History

2019-09-29 09:07:27 -04:00
# frozen_string_literal: true
class GoodTextValidator < ApplicationEachValidator
class Validation < Validation
GOOD_TEXT_RE = /\A[^\s](.*[^\s])?\z/.freeze
def perform
error :blank if str_value.blank?
2019-09-30 07:52:46 -04:00
error :good_text unless GOOD_TEXT_RE.match? value
2019-09-29 09:07:27 -04:00
end
end
end