Module: Export::Coldp::Files::Reference
- Defined in:
- lib/export/coldp/files/reference.rb
Overview
Class Method Summary collapse
- .add_reference_rows(sources = [], reference_csv) ⇒ Object
-
.generate(project_id) ⇒ Object
This default method dumps the whole of project sources, as an alternate way to generate the reference file.
- .ref_row(source) ⇒ Object
-
.reference_details(source) ⇒ Object
TODO: this makes little sense without more structure, just spam stuff in until we understand more.
Class Method Details
.add_reference_rows(sources = [], reference_csv) ⇒ Object
18 19 20 21 22 |
# File 'lib/export/coldp/files/reference.rb', line 18 def self.add_reference_rows(sources = [], reference_csv) sources.each do |s| reference_csv[s.id] = ref_row(s) end end |
.generate(project_id) ⇒ Object
This default method dumps the whole of project sources, as an alternate way to generate the reference file.
!! It is not integrated yet.
10 11 12 13 14 15 16 |
# File 'lib/export/coldp/files/reference.rb', line 10 def self.generate(project_id) CSV.generate do |csv| Source.joins(:project_sources).where(project_sources: {project_id: project_id} ).each do |source| csv << ref_row(source) end end end |
.ref_row(source) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/export/coldp/files/reference.rb', line 24 def self.ref_row(source) [ source.id, source.cached, # source.cached_author_string, # source.year, # source.journal, # source.source # reference_details(source), # details (pages, volume, year) source.doi ] end |
.reference_details(source) ⇒ Object
TODO: this makes little sense without more structure, just spam stuff in until we understand more
37 38 39 |
# File 'lib/export/coldp/files/reference.rb', line 37 def self.reference_details(source) [source.volume, source.number, source.pages, source.bibtex_type].compact.join(';') end |