Class: Mail::ToField

Inherits:
CommonAddressField
  • Object
show all
Defined in:
lib/jpmobile/mail.rb

Instance Method Summary collapse

Instance Method Details

#encoded_with_jpmobileObject Also known as: encoded



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/jpmobile/mail.rb', line 552

def encoded_with_jpmobile
  if @mobile
    self.charset = @mobile.mail_charset

    _value = element.addresses.map {|_a|
      if Utilities.blank?(_a.display_name) || _a.display_name.ascii_only?
        _a.to_s
      else
        "#{@mobile.to_mail_subject(_a.display_name)} <#{_a.address}>"
      end
    }.join(', ')
    @element = AddressList.new(_value)
  end

  encoded_without_jpmobile
end

#initialize_with_jpmobile(value = nil, charset = 'utf-8') ⇒ Object Also known as: initialize



535
536
537
538
# File 'lib/jpmobile/mail.rb', line 535

def initialize_with_jpmobile(value = nil, charset = 'utf-8')
  @jpmobile_raw_text = value
  initialize_without_jpmobile(value, charset)
end

#mobile=(m) ⇒ Object



543
544
545
546
547
548
549
550
# File 'lib/jpmobile/mail.rb', line 543

def mobile=(m)
  @mobile = m
  if @mobile
    self.charset = @mobile.mail_charset
    self.value   = @jpmobile_raw_text
    self.parse
  end
end