class Jpmobile::Email
email関連の処理
Public Class Methods
convertable?(content_type)
click to toggle source
# File lib/jpmobile/email.rb, line 47 def convertable?(content_type) if @@converting_content_type.respond_to?(:each) @@converting_content_type.each do |c| return true if content_type.match(c) end end nil end
detect(email)
click to toggle source
メールアドレスよりキャリア情報を取得する
- param1
-
email メールアドレス
- return
-
Jpmobile::Mobileで定義されている携帯キャリアクラス
# File lib/jpmobile/email.rb, line 13 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}$/) end nil end
detect_from_mail_header(header)
click to toggle source
含まれているメールアドレスからキャリア情報を取得する
# File lib/jpmobile/email.rb, line 22 def detect_from_mail_header(header) Mobile.carriers.each do |const| c = Mobile.const_get(const) if c::MAIL_ADDRESS_REGEXP && header.match(/(\S+@[A-Za-z0-9\-\.\_]+)/) && $1.match(/^#{c::MAIL_ADDRESS_REGEXP}$/) return c end end if japanese_mail?(header) return Jpmobile::Mobile::AbstractMobile end nil end
japanese_mail?(header)
click to toggle source
# File lib/jpmobile/email.rb, line 43 def japanese_mail?(header) @@japanese_mail_address_regexp and header.match(@@japanese_mail_address_regexp) end
japanese_mail_address_regexp=(regexp)
click to toggle source
# File lib/jpmobile/email.rb, line 39 def japanese_mail_address_regexp=(regexp) @@japanese_mail_address_regexp = regexp end