Class: Mail::FromField

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



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/jpmobile/mail.rb', line 513

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



496
497
498
499
# File 'lib/jpmobile/mail.rb', line 496

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

#mobile=(m) ⇒ Object



504
505
506
507
508
509
510
511
# File 'lib/jpmobile/mail.rb', line 504

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