Class Bio::LITDB
In: lib/bio/db/litdb.rb
Parent: NCBIDB

LITDB class

Methods

author   entry_id   field   journal   keyword   new   reference   title   volume  

Constants

DELIMITER = "\nEND\n"   Delimiter
RS = DELIMITER   Delimiter
TAGSIZE = 12  

Public Class methods

[Source]

    # File lib/bio/db/litdb.rb, line 27
27:     def initialize(entry)
28:       super(entry, TAGSIZE)
29:     end

Public Instance methods

AUTHOR

[Source]

    # File lib/bio/db/litdb.rb, line 84
84:     def author
85:       field_fetch('AUTHOR')
86:     end

CODE

[Source]

    # File lib/bio/db/litdb.rb, line 51
51:     def entry_id
52:       field_fetch('CODE')
53:     end

FIELD

[Source]

    # File lib/bio/db/litdb.rb, line 61
61:     def field
62:       field_fetch('FIELD')
63:     end

JOURNAL

[Source]

    # File lib/bio/db/litdb.rb, line 66
66:     def journal
67:       field_fetch('JOURNAL')
68:     end

KEYWORD ’;;’

[Source]

    # File lib/bio/db/litdb.rb, line 76
76:     def keyword
77:       unless @data['KEYWORD']
78:         @data['KEYWORD'] = fetch('KEYWORD').split(/;;\s*/)
79:       end
80:       @data['KEYWORD']
81:     end

Returns

[Source]

    # File lib/bio/db/litdb.rb, line 32
32:     def reference
33:       hash = Hash.new('') 
34: 
35:       hash['authors'] = author.split(/;/).map {|x| x.sub(/,/, ', ')}
36:       hash['title']   = title 
37:       hash['journal'] = journal.gsub(/\./, '. ').strip
38: 
39:       vol = volume.split(/,\s+/)
40:       if vol.size > 1
41:         hash['volume'] = vol.shift.sub(/Vol\./, '')
42:         hash['pages'],
43:         hash['year'] = vol.pop.split(' ')
44:         hash['issue'] = vol.shift.sub(/No\./, '') unless vol.empty?
45:       end
46: 
47:       return Reference.new(hash) 
48:     end

TITLE

[Source]

    # File lib/bio/db/litdb.rb, line 56
56:     def title
57:       field_fetch('TITLE')
58:     end

VOLUME

[Source]

    # File lib/bio/db/litdb.rb, line 71
71:     def volume
72:       field_fetch('VOLUME')
73:     end

[Validate]