Module: Serializers::EndNote
- Included in:
- Document
- Defined in:
- lib/serializers/end_note.rb
Overview
Convert a document to an EndNote record
Class Method Summary (collapse)
-
+ (Object) included(base)
Register this serializer in the Document list.
Instance Method Summary (collapse)
-
- (String) to_endnote
Returns this document as an EndNote record.
Class Method Details
+ (Object) included(base)
Register this serializer in the Document list
9 10 11 12 |
# File 'lib/serializers/end_note.rb', line 9 def self.included(base) base.register_serializer(:endnote, 'EndNote', lambda { |doc| doc.to_endnote }, 'http://auditorymodels.org/jba/bibs/NetBib/Tools/bp-0.2.97/doc/endnote.html') end |
Instance Method Details
- (String) to_endnote
Returns this document as an EndNote record
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/serializers/end_note.rb', line 20 def to_endnote ret = "%0 Journal Article\n" if && .count .each do |a| ret << "%A #{a.last}, #{a.first}" ret << " #{a.von}" unless a.von.blank? ret << ", #{a.suffix}" unless a.suffix.blank? ret << "\n" end end ret << "%T #{title}\n" unless title.blank? ret << "%D #{year}\n" unless year.blank? ret << "%J #{journal}\n" unless journal.blank? ret << "%V #{volume}\n" unless volume.blank? ret << "%N #{number}\n" unless number.blank? ret << "%P #{pages}\n" unless pages.blank? ret << "%M #{doi}\n" unless doi.blank? ret << "\n" ret end |