Class | Bio::FlatFile::AutoDetect::RuleRegexp
In: | lib/bio/io/flatfile/autodetection.rb
Parent: | RuleTemplate

A autodetection rule to use a regular expression

### Methods

dbclasses guess new

### Public Class methods

new(dbclass, re)

Creates a new instance.

[Source]

         # File lib/bio/io/flatfile/autodetection.rb, line 145
    145:         def initialize(dbclass, re)
    146:           super()
    147:           @re = re
    148:           @name = dbclass.to_s
    149:           @dbclass = nil
    150:           @dbclass_lazy = dbclass
    151:         end

### Public Instance methods

dbclasses()

returns database classes

[Source]

         # File lib/bio/io/flatfile/autodetection.rb, line 163
    163:         def dbclasses
    164:           [ dbclass ]
    165:         end

guess(text, meta)

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

[Source]

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

[Validate]