Method: Mail::Body#split!
- Defined in:
- lib/jpmobile/mail.rb
#split!(boundary) ⇒ Object
414 415 416 417 418 419 420 421 422 423 |
# File 'lib/jpmobile/mail.rb', line 414 def split!(boundary) self.boundary = boundary parts = raw_source.split(/(?:\A|\r\n)--#{Regexp.escape(boundary)}(?=(?:--)?\s*$)/) # Make the preamble equal to the preamble (if any) self.preamble = parts[0].to_s.strip # Make the epilogue equal to the epilogue (if any) self.epilogue = parts[-1].to_s.sub('--', '').strip parts[1...-1].to_a.each {|part| @parts << Mail::Part.new(body_raw: part, mobile: @mobile) } self end |