Module: FailFast::CheckEmail

Defined in:
lib/fail_fast/extensions/check_email.rb

Instance Method Summary collapse

Instance Method Details

#has_email_for(key, *params) ⇒ Object

Usage

has_email_for 'test/admin_email'


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fail_fast/extensions/check_email.rb', line 7

def has_email_for(key, *params)
  p = key_value_regexp_options(key, params)
  key, options = p.key, p.options

  return unless has_value_for key, :message =>  options[:message]

  value = value_for_deep_key(key)
  if EmailValidator.invalid_email_address?(value)
    add_error ErrorDetails.new(key, :not_an_email, value, options[:message])
  end
end