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

A autodetection rule that passes data to the proc object.

### Methods

dbclasses guess new

### Public Class methods

new(*dbclasses, &proc)

Creates a new instance.

[Source]

         # File lib/bio/io/flatfile/autodetection.rb, line 199
    199:         def initialize(*dbclasses, &proc)
    200:           super()
    201:           @proc = proc
    202:           @dbclasses = nil
    203:           @dbclasses_lazy = dbclasses
    204:           @name = dbclasses.collect { |x| x.to_s }.join('|')
    205:         end

### Public Instance methods

dbclasses()

database classes (lazy evaluation)

[Source]

         # File lib/bio/io/flatfile/autodetection.rb, line 208
    208:         def dbclasses
    209:           unless @dbclasses
    210:             @dbclasses = @dbclasses_lazy.collect { |x| get_dbclass(x) }
    211:           end
    212:           @dbclasses
    213:         end

guess(text, meta)

If given text (and/or meta information) is known, returns the database class. Otherwise, returns nil or false.

Refer RuleTemplate#guess for meta.

[Source]

         # File lib/bio/io/flatfile/autodetection.rb, line 220
    220:         def guess(text, meta)
    221:           @proc.call(text)
    222:         end

[Validate]