Class: GmailExtractor::EmailXmlFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/gmail_extractor/email_formatter/email_xml_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(printer) ⇒ EmailXmlFormatter

Returns a new instance of EmailXmlFormatter.



7
8
9
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 7

def initialize(printer)
  @printer = printer
end

Instance Attribute Details

#printerObject

Returns the value of attribute printer.



5
6
7
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 5

def printer
  @printer
end

Instance Method Details

#email(email) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 24

def email(email)
  result = ""
  result << "<email>"
  result << "<from>#{email.from}</from>"
  result << "<date>#{email.date}</date>"
  result << "<content>#{email.content}</content>"
  result << "</email>"

  @printer << result
end


17
18
19
20
21
22
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 17

def footer
  result = "</emails>"

  @printer << result
  @printer.close
end

#headerObject



11
12
13
14
15
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 11

def header
  result = "<emails>"

  @printer << result
end

#label(label, limit) ⇒ Object



35
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 35

def label(label,limit); end