Class: Bio::FlatFile::AutoDetect::RuleRegexp
- Inherits:
-
RuleTemplate
- Object
- RuleTemplate
- Bio::FlatFile::AutoDetect::RuleRegexp
- Defined in:
- lib/bio/io/flatfile/autodetection.rb
Overview
A autodetection rule to use a regular expression
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from RuleTemplate
#higher_priority_elements, #lower_priority_elements, #name
Instance Method Summary collapse
-
#dbclasses ⇒ Object
returns database classes.
-
#guess(text, meta) ⇒ Object
If given text matches the regexp, returns the database class.
-
#initialize(dbclass, re) ⇒ RuleRegexp
constructor
Creates a new instance.
Methods inherited from RuleTemplate
Constructor Details
#initialize(dbclass, re) ⇒ RuleRegexp
Creates a new instance.
145 146 147 148 149 150 151 |
# 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 |
Instance Method Details
#dbclasses ⇒ Object
returns database classes
163 164 165 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 163 def dbclasses [ dbclass ] end |
#guess(text, meta) ⇒ Object
If given text matches the regexp, returns the database class. Otherwise, returns nil or false. meta is ignored.
170 171 172 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 170 def guess(text, ) @re =~ text ? dbclass : nil end |