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, line 180
def initialize(dbclass, *regexps)
  super(dbclass, nil)
  @regexps = regexps

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, line 188
def guess(text, meta)
  @regexps.each do |re|
    return dbclass if re =~ text