Class: Bio::FlatFile::AutoDetect::RuleTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/io/flatfile.rb

Overview

Template of a single rule of autodetection

Direct Known Subclasses

RuleDebug, RuleProc, RuleRegexp, RuleSpecial

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRuleTemplate

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

#dbclassesObject (readonly)

database classes



821
822
823
# File 'lib/bio/io/flatfile.rb', line 821

def dbclasses
  @dbclasses
end

#higher_priority_elementsObject (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_elementsObject (readonly)

lower priority elements



818
819
820
# File 'lib/bio/io/flatfile.rb', line 818

def lower_priority_elements
  @lower_priority_elements
end

#nameObject

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, meta)
  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