Class: Reference

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/reference.rb

Overview

Reference model

Instance Method Summary collapse

Instance Method Details

#bibtexifyObject

Bibtexify Prints out the model in BibTeX format. Reason why every line is put in separately is for later use, when we have multiple different types that have different formats.


21
22
23
24
25
26
27
28
29
30
# File 'app/models/reference.rb', line 21

def bibtexify
	bibtex = "@#{self.reference_type}{"
	bibtex += "#{self.author.split(' ')[0]}#{self.year},\n"
	bibtex += "	author = #{self.author},\n"
	bibtex += "	title = #{self.title},\n"
	bibtex += "	year = #{self.year},\n"
	bibtex += "	publisher = #{self.publisher}\n"
	bibtex += "}"
	bibtex
end