Class: Bio::FlatFile::AutoDetect::RuleTemplate
- Defined in:
- lib/bio/io/flatfile/autodetection.rb
Overview
Template of a single rule of autodetection
Direct Known Subclasses
Instance Attribute Summary collapse
-
#dbclasses ⇒ Object
readonly
database classes.
-
#higher_priority_elements ⇒ Object
readonly
higher priority elements.
-
#lower_priority_elements ⇒ Object
readonly
lower priority elements.
-
#name ⇒ Object
unique name of the element.
Class Method Summary collapse
-
.[](*arg) ⇒ Object
Creates a new element.
Instance Method Summary collapse
-
#guess(text, meta) ⇒ Object
If given text (and/or meta information) is known, returns the database class.
-
#initialize ⇒ RuleTemplate
constructor
Creates a new element.
-
#is_prior_to(elem) ⇒ Object
self is prior to the elem.
Constructor Details
#initialize ⇒ RuleTemplate
Creates a new element.
43 44 45 46 47 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 43 def initialize @higher_priority_elements = RulesArray.new @lower_priority_elements = RulesArray.new @name = nil end |
Instance Attribute Details
#dbclasses ⇒ Object (readonly)
database classes
63 64 65 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 63 def dbclasses @dbclasses end |
#higher_priority_elements ⇒ Object (readonly)
higher priority elements
58 59 60 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 58 def higher_priority_elements @higher_priority_elements end |
#lower_priority_elements ⇒ Object (readonly)
lower priority elements
60 61 62 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 60 def lower_priority_elements @lower_priority_elements end |
#name ⇒ Object
unique name of the element
66 67 68 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 66 def name @name end |
Class Method Details
.[](*arg) ⇒ Object
Creates a new element.
38 39 40 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 38 def self.[](*arg) self.new(*arg) end |
Instance Method Details
#guess(text, meta) ⇒ Object
If given text (and/or meta information) is known, returns the database class. Otherwise, returns nil or false.
text will be a String. meta will be a Hash. meta may contain following keys. :path => pathname, filename or uri.
76 77 78 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 76 def guess(text, ) nil end |
#is_prior_to(elem) ⇒ Object
self is prior to the elem.
50 51 52 53 54 55 |
# File 'lib/bio/io/flatfile/autodetection.rb', line 50 def is_prior_to(elem) return nil if self == elem elem.higher_priority_elements << self self.lower_priority_elements << elem true end |