[FEATURE] Better handling nil or non-string values?
duckworth opened this issue · comments
John Lemp commented
New Issue Checklist
- I have updated truemail to the latest version
- I have read the Contribution Guidelines
- I have read the documentation
- I have searched for existing GitHub issues
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.
Vladislav Trotsenko commented
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!