class Bio::FlatFile::AutoDetect::RuleRegexp2

A autodetection rule to use more than two regular expressions. If given string matches one of the regular expressions, returns the database class.

Public Class Methods

new(dbclass, *regexps) click to toggle source

Creates a new instance.

    # File lib/bio/io/flatfile/autodetection.rb
180 def initialize(dbclass, *regexps)
181   super(dbclass, nil)
182   @regexps = regexps
183 end

Public Instance Methods

guess(text, meta) click to toggle source

If given text matches one of the regexp, returns the database class. Otherwise, returns nil or false. meta is ignored.

    # File lib/bio/io/flatfile/autodetection.rb
188 def guess(text, meta)
189   @regexps.each do |re|
190     return dbclass if re =~ text
191   end
192   nil
193 end