class Bio::FlatFile::AutoDetect::RuleProc

A autodetection rule that passes data to the proc object.

Public Class Methods

new(*dbclasses, &proc) click to toggle source

Creates a new instance.

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

Public Instance Methods

dbclasses() click to toggle source

database classes (lazy evaluation)

# File lib/bio/io/flatfile/autodetection.rb, line 208
def dbclasses
  unless @dbclasses
    @dbclasses = @dbclasses_lazy.collect { |x| get_dbclass(x) }
  end
  @dbclasses
end
guess(text, meta) click to toggle source

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

Refer Bio::FlatFile::AutoDetect::RuleTemplate#guess for meta.

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