Module: Rack::AddressMunging::Detection
- Included in:
- Strategy::Hex, Strategy::Rot13JS
- Defined in:
- lib/rack/address_munging/detection.rb
Overview
This module contains email address detection and validation methods. It is meant to be included in any munging strategy.
Constant Summary collapse
- REGEXP_EMAIL =
/[a-z0-9][^@\s'":<>]+@[^@\s'":<>]+[a-z0-9]/i- REGEXP_MAILTO =
/mailto:#{REGEXP_EMAIL}/i- REGEXP_LINK =
%r{<a[^>]+?href="#{REGEXP_MAILTO}"[^>]*?>.+?</a>}i
Instance Method Summary collapse
Instance Method Details
#email?(string) ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rack/address_munging/detection.rb', line 15 def email?(string) m = ::Mail::Address.new(string) return false unless m.address == string return false unless valid_local?(m.local) return false unless valid_domain?(m.domain) true rescue StandardError false end |