truemail-rb / truemail

🚀 Configurable framework agnostic plain Ruby 📨 email validator/verifier. Verify email via Regex, DNS, SMTP and even more. Be sure that email address valid and exists.

Home Page:https://truemail-rb.org/truemail-gem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Better handling nil or non-string values?

duckworth opened this issue · comments

New Issue Checklist

Issue Description

Calling Truemail.validate() or Truemail.valid?() with nil or non String values throws errors.

Complete output when running truemail, including the stack trace and command used
 Truemail.valid?(nil)
NoMethodError: undefined method `[]' for nil:NilClass
from .../gems/ruby-2.6.5/gems/truemail-1.9.1/lib/truemail/validator.rb:42:in `select_validation_type'

Took me a while to track down why my Validator was failing and seems somewhat unexpected result.

Hi, @duckworth! Thanks for your feedback. Follows the docs it's an expected behaviour for these cases. But I will add type-check handler in next release. Cheers!