class Bio::FlatFile::AutoDetect::RuleRegexp

A autodetection rule to use a regular expression

Public Class Methods

new(dbclass, re) click to toggle source

Creates a new instance.

# File lib/bio/io/flatfile/autodetection.rb, line 145
def initialize(dbclass, re)
  super()
  @re = re
  @name = dbclass.to_s
  @dbclass = nil
  @dbclass_lazy = dbclass
end

Public Instance Methods

dbclasses() click to toggle source

returns database classes

# File lib/bio/io/flatfile/autodetection.rb, line 163
def dbclasses
  [ dbclass ]
end
guess(text, meta) click to toggle source

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

# File lib/bio/io/flatfile/autodetection.rb, line 170
def guess(text, meta)
  @re =~ text ? dbclass : nil
end