Class: Git::Lint::Validators::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/git/lint/validators/email.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, pattern: URI::MailTo::EMAIL_REGEXP) ⇒ Email

Returns a new instance of Email.



9
10
11
12
# File 'lib/git/lint/validators/email.rb', line 9

def initialize text, pattern: URI::MailTo::EMAIL_REGEXP
  @text = text
  @pattern = pattern
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/git/lint/validators/email.rb', line 14

def valid?
  String(text).match? pattern
end