Class: GmailExtractor::EmailXmlFormatter
- Inherits:
-
Object
- Object
- GmailExtractor::EmailXmlFormatter
- Defined in:
- lib/gmail_extractor/email_formatter/email_xml_formatter.rb
Instance Attribute Summary collapse
-
#printer ⇒ Object
Returns the value of attribute printer.
Instance Method Summary collapse
- #email(email) ⇒ Object
- #footer ⇒ Object
- #header ⇒ Object
-
#initialize(printer) ⇒ EmailXmlFormatter
constructor
A new instance of EmailXmlFormatter.
- #label(label, limit) ⇒ Object
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
#printer ⇒ Object
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 |
#footer ⇒ Object
17 18 19 20 21 22 |
# File 'lib/gmail_extractor/email_formatter/email_xml_formatter.rb', line 17 def result = "</emails>" @printer << result @printer.close end |
#header ⇒ Object
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 |