Class: Bio::LITDB
Overview
LITDB class
Constant Summary collapse
- DELIMITER =
Delimiter
"\nEND\n"
- RS =
Delimiter
DELIMITER
- TAGSIZE =
12
Instance Method Summary collapse
-
#author ⇒ Object
AUTHOR.
-
#entry_id ⇒ Object
CODE.
-
#field ⇒ Object
FIELD.
-
#initialize(entry) ⇒ LITDB
constructor
A new instance of LITDB.
-
#journal ⇒ Object
JOURNAL.
-
#keyword ⇒ Object
KEYWORD ‘;;’.
-
#reference ⇒ Object
Returns.
-
#title ⇒ Object
TITLE.
-
#volume ⇒ Object
VOLUME.
Methods inherited from DB
#exists?, #fetch, #get, open, #tags
Constructor Details
Instance Method Details
#author ⇒ Object
AUTHOR
84 85 86 |
# File 'lib/bio/db/litdb.rb', line 84 def field_fetch('AUTHOR') end |
#entry_id ⇒ Object
CODE
51 52 53 |
# File 'lib/bio/db/litdb.rb', line 51 def entry_id field_fetch('CODE') end |
#field ⇒ Object
FIELD
61 62 63 |
# File 'lib/bio/db/litdb.rb', line 61 def field field_fetch('FIELD') end |
#journal ⇒ Object
JOURNAL
66 67 68 |
# File 'lib/bio/db/litdb.rb', line 66 def journal field_fetch('JOURNAL') end |
#keyword ⇒ Object
KEYWORD ‘;;’
76 77 78 79 80 81 |
# File 'lib/bio/db/litdb.rb', line 76 def keyword unless @data['KEYWORD'] @data['KEYWORD'] = fetch('KEYWORD').split(/;;\s*/) end @data['KEYWORD'] end |
#reference ⇒ Object
Returns
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bio/db/litdb.rb', line 32 def reference hash = Hash.new('') hash['authors'] = .split(/;/).map {|x| x.sub(/,/, ', ')} hash['title'] = title hash['journal'] = journal.gsub(/\./, '. ').strip vol = volume.split(/,\s+/) if vol.size > 1 hash['volume'] = vol.shift.sub(/Vol\./, '') hash['pages'], hash['year'] = vol.pop.split(' ') hash['issue'] = vol.shift.sub(/No\./, '') unless vol.empty? end return Reference.new(hash) end |
#title ⇒ Object
TITLE
56 57 58 |
# File 'lib/bio/db/litdb.rb', line 56 def title field_fetch('TITLE') end |
#volume ⇒ Object
VOLUME
71 72 73 |
# File 'lib/bio/db/litdb.rb', line 71 def volume field_fetch('VOLUME') end |