Sha256: 873e72e5c4a4c8c89e0b930d23e7a61a18815eda71a2891e5083001df6a17485

Contents?: true

Size: 289 Bytes

Versions: 4

Compression:

Stored size: 289 Bytes

Contents

module Rosebud
  module Validations
    class RegexValidator < Validator
      def validate_param(name, value, pattern)
        error!(:regex, param: name) if value && (value.to_s =~ pattern).nil?
      end
    end
    
    Validations.register_validator!(:regex, RegexValidator)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rosebud-0.2.0 lib/rosebud/validations/regex_validator.rb
rosebud-0.1.2 lib/rosebud/validations/regex_validator.rb
rosebud-0.1.1 lib/rosebud/validations/regex_validator.rb
rosebud-0.1.0 lib/rosebud/validations/regex_validator.rb