Module: Hyrax::SolrDocument::Export
- Included in:
- Hyrax::SolrDocumentBehavior
- Defined in:
- app/models/concerns/hyrax/solr_document/export.rb
Constant Summary collapse
- END_NOTE_MAPPINGS =
{ '%T' => [:title], '%A' => [:creator], '%C' => [:publication_place], '%D' => [:date_created], '%8' => [:date_uploaded], '%E' => [:contributor], '%I' => [:publisher], '%J' => [:series_title], '%@' => [:isbn], '%U' => [:related_url], '%7' => [:edition_statement], '%R' => [:persistent_url], '%X' => [:description], '%G' => [:language], '%[' => [:date_modified], '%9' => [:resource_type] }.freeze
Instance Method Summary collapse
- #end_note_format ⇒ Object
-
#endnote_filename ⇒ Object
Name of the downloaded endnote file Override this if you want to use a different name.
-
#export_as_endnote ⇒ Object
MIME: ‘application/x-endnote-refer’.
- #persistent_url ⇒ Object
Instance Method Details
#end_note_format ⇒ Object
53 54 55 56 |
# File 'app/models/concerns/hyrax/solr_document/export.rb', line 53 def end_note_format END_NOTE_MAPPINGS.merge({ '%~' => I18n.t('hyrax.product_name'), '%W' => Institution.name }) end |
#endnote_filename ⇒ Object
Name of the downloaded endnote file Override this if you want to use a different name
45 46 47 |
# File 'app/models/concerns/hyrax/solr_document/export.rb', line 45 def endnote_filename "#{id}.endnote" end |
#export_as_endnote ⇒ Object
MIME: ‘application/x-endnote-refer’
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/concerns/hyrax/solr_document/export.rb', line 24 def export_as_endnote text = ["%0 #{human_readable_type}"] end_note_format.each do |endnote_key, mapping| if mapping.is_a? String values = [mapping] else values = send(mapping[0]) if respond_to? mapping[0] values = mapping[1].call(values) if mapping.length == 2 values = Array.wrap(values) end next if values.blank? || values.first.nil? spaced_values = values.join("; ") text << "#{endnote_key} #{spaced_values}" end text.join("\n") end |
#persistent_url ⇒ Object
49 50 51 |
# File 'app/models/concerns/hyrax/solr_document/export.rb', line 49 def persistent_url "#{Hyrax.config.persistent_hostpath}#{id}" end |