Sha256: 3e0d785eeccd020ff4ff689c1b39e09d9346703008b901ecd95aeb1ca8fb99ea

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

require 'validator/generic_validator'

module Owasp
  module Esapi
    module Validator
      class Email < GenericValidator
        
        EMAIL_REGEX = "^(\\w)+[@](\\w)+[.]\\w{3}$"
        # In order to make a strong validation for email addresses, it might be a good idea to 
        # make a check for the domain tld.
        # This is a very optional and beta feature, so it is turned off by default.
        attr_reader :validate_tld
        
        def initialize(options=nil)
          validate_tld = false
          @matcher = EMAIL_REGEX
          super(@matcher)
          
          unless options.nil? 
            if options.has_key? "validate_tld"
              validate_tld = options["validate_tld"]
            end
          end
        end
      
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
owasp-esapi-ruby-0.30.0 lib/validator/email.rb