Class: Courrier::Email::Transformer

Inherits:
Object
  • Object
show all
Defined in:
lib/courrier/email/transformer.rb

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Transformer

Returns a new instance of Transformer.



8
9
10
# File 'lib/courrier/email/transformer.rb', line 8

def initialize(content)
  @content = content
end

Instance Method Details

#to_textObject



12
13
14
15
16
17
18
# File 'lib/courrier/email/transformer.rb', line 12

def to_text
  Nokogiri::HTML(@content)
    .then { remove_unwanted_elements(_1) }
    .then { process_links(_1) }
    .then { preserve_line_breaks(_1) }
    .then { clean_up(_1) }
end