Class: RubyEmail::Core
- Inherits:
-
Object
- Object
- RubyEmail::Core
- Defined in:
- lib/ruby_email/core.rb
Overview
Abstract class to inherit and complete by adding the REGEXP constant
Class Method Summary collapse
-
.match(str) ⇒ MatchData or NilClass
Check if the string is a valid email and details how.
-
.regexp ⇒ Regexp
Constant to erase in the children.
-
.validates?(str) ⇒ TrueClass or FalseClass
Check if the String is a valid email.
Class Method Details
.match(str) ⇒ MatchData or NilClass
Check if the string is a valid email and details how
17 18 19 20 |
# File 'lib/ruby_email/core.rb', line 17 def self.match str raise ArgumentError, "Cannot validate a `#{str.class}`. Only `String` can be." unless str.is_a?(String) str.match regexp end |
.regexp ⇒ Regexp
Returns constant to erase in the children.
23 24 25 26 |
# File 'lib/ruby_email/core.rb', line 23 def self.regexp self::REGEXP #raise NoMethodError, "Not implemented in #{self.class}" end |
.validates?(str) ⇒ TrueClass or FalseClass
Check if the String is a valid email.
9 10 11 |
# File 'lib/ruby_email/core.rb', line 9 def self.validates? str !!match(str) end |