Class: ArticleJSON::Export::PlainText::Exporter
- Inherits:
-
Object
- Object
- ArticleJSON::Export::PlainText::Exporter
- Defined in:
- lib/article_json/export/plain_text/exporter.rb
Instance Method Summary collapse
-
#initialize(elements) ⇒ Exporter
constructor
A new instance of Exporter.
-
#text ⇒ String
Generate a string with the plain text representation of all elements.
Constructor Details
#initialize(elements) ⇒ Exporter
Returns a new instance of Exporter.
6 7 8 |
# File 'lib/article_json/export/plain_text/exporter.rb', line 6 def initialize(elements) @elements = elements end |
Instance Method Details
#text ⇒ String
Generate a string with the plain text representation of all elements
12 13 14 15 16 17 18 19 |
# File 'lib/article_json/export/plain_text/exporter.rb', line 12 def text @text ||= @elements.map do |element| ArticleJSON::Export::PlainText::Elements::Base .build(element) &.export end.join.strip end |