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

12 lines
292 B
Ruby

# 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?
error :good_text unless GOOD_TEXT_RE.match? value
end
end
end