Class: Bio::FlatFile::AutoDetect::RuleTemplate
- Defined in:
- lib/bio/io/flatfile.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.
801 802 803 804 805 |
# File 'lib/bio/io/flatfile.rb', line 801 def initialize @higher_priority_elements = RulesArray.new @lower_priority_elements = RulesArray.new @name = nil end |
Instance Attribute Details
#dbclasses ⇒ Object (readonly)
database classes
821 822 823 |
# File 'lib/bio/io/flatfile.rb', line 821 def dbclasses @dbclasses end |
#higher_priority_elements ⇒ Object (readonly)
higher priority elements
816 817 818 |
# File 'lib/bio/io/flatfile.rb', line 816 def higher_priority_elements @higher_priority_elements end |
#lower_priority_elements ⇒ Object (readonly)
lower priority elements
818 819 820 |
# File 'lib/bio/io/flatfile.rb', line 818 def lower_priority_elements @lower_priority_elements end |
#name ⇒ Object
unique name of the element
824 825 826 |
# File 'lib/bio/io/flatfile.rb', line 824 def name @name end |
Class Method Details
.[](*arg) ⇒ Object
Creates a new element.
796 797 798 |
# File 'lib/bio/io/flatfile.rb', line 796 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.
834 835 836 |
# File 'lib/bio/io/flatfile.rb', line 834 def guess(text, ) nil end |
#is_prior_to(elem) ⇒ Object
self is prior to the elem.
808 809 810 811 812 813 |
# File 'lib/bio/io/flatfile.rb', line 808 def is_prior_to(elem) return nil if self == elem elem.higher_priority_elements << self self.lower_priority_elements << elem true end |