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
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() click to toggle source

database classes (lazy evaluation)

    # File lib/bio/io/flatfile/autodetection.rb
208 def dbclasses
209   unless @dbclasses
210     @dbclasses = @dbclasses_lazy.collect { |x| get_dbclass(x) }
211   end
212   @dbclasses
213 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 RuleTemplate#guess for meta.

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