class Bio::DB
Public Class Methods
open(filename, *mode, &block)
click to toggle source
# File lib/bio/db.rb 156 def self.open(filename, *mode, &block) 157 Bio::FlatFile.open(self, filename, *mode, &block) 158 end
Public Instance Methods
entry_id()
click to toggle source
Returns an entry identifier as a String. This method must be implemented in every database classes by overriding this method.
# File lib/bio/db.rb 162 def entry_id 163 raise NotImplementedError 164 end
exists?(tag)
click to toggle source
Returns true or false - wether the entry contains the field of the given tag name.
# File lib/bio/db.rb 173 def exists?(tag) 174 @orig.include?(tag) 175 end
fetch(tag, skip = 0)
click to toggle source
Similar to the get method, however, fetch returns the content of the field without its tag and any extra white spaces stripped.
# File lib/bio/db.rb 184 def fetch(tag, skip = 0) 185 field = @orig[tag].split(/\n/, skip + 1).last.to_s 186 truncate(field.gsub(/^.{0,#{@tagsize}}/,'')) 187 end
get(tag)
click to toggle source
Returns an intact field of the tag as a String.
# File lib/bio/db.rb 178 def get(tag) 179 @orig[tag] 180 end