Method: Jpmobile::Email.detect
- Defined in:
- lib/jpmobile/email.rb
.detect(email) ⇒ Object
メールアドレスよりキャリア情報を取得する
- param1
-
email メールアドレス
- return
-
Jpmobile::Mobileで定義されている携帯キャリアクラス
10 11 12 13 14 15 16 |
# File 'lib/jpmobile/email.rb', line 10 def detect(email) Mobile.carriers.each do |const| c = Mobile.const_get(const) return c if c::MAIL_ADDRESS_REGEXP && email.match(/^#{c::MAIL_ADDRESS_REGEXP}$/) # rubocop:disable Performance/ConstantRegexp end nil end |