Sha256: d79c1d2eba0c339528e3f334eac2d7871b02d6df081d16818a8b6d8dc5d95a87
Contents?: true
Size: 870 Bytes
Versions: 1
Compression:
Stored size: 870 Bytes
Contents
require "email_detected/version" module EmailDetected require 'email_detected/config' require 'email_detected/checker' require 'email_detected/messages' require 'email_detected/validates_exist_email' VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i def self.exist?(email) return true if config.test_mode return { status: false, errors: ['The email address invalid.'] } unless email.match VALID_EMAIL_REGEX email_detected = EmailDetected::Checker.run(email) if email_detected.invalid? resp = { status: false, message: email_detected.errors.first } else resp = { status: true, message: 'The email address has already been registered.' } end resp end def self.config(&block) if block_given? block.call(EmailDetected::Config) else EmailDetected::Config end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
email_detected-0.1.0 | lib/email_detected.rb |