Module: Blacklight::Document::Email

Defined in:
app/models/concerns/blacklight/document/email.rb

Overview

This module provides the body of an email export based on the document's semantic values

Instance Method Summary collapse

Instance Method Details

#to_email_textObject

Return a text string that will be the body of the email



5
6
7
8
9
10
11
12
13
# File 'app/models/concerns/blacklight/document/email.rb', line 5

def to_email_text
  semantics = self.to_semantic_values
  body = []
  body << I18n.t('blacklight.email.text.title', value: semantics[:title].join(" ")) unless semantics[:title].blank?
  body << I18n.t('blacklight.email.text.author', value: semantics[:author].join(" ")) unless semantics[:author].blank?
  body << I18n.t('blacklight.email.text.format', value: semantics[:format].join(" ")) unless semantics[:format].blank?
  body << I18n.t('blacklight.email.text.language', value: semantics[:language].join(" ")) unless semantics[:language].blank?
  return body.join("\n") unless body.empty?
end