class Bio::Sequence::Format::FormatterBase

Formatter base class. Any formatter class should inherit this class.

Public Class Methods

new(sequence, options = {}) click to toggle source

creates a new formatter object for output

    # File lib/bio/sequence/format.rb
111 def initialize(sequence, options = {})
112   @sequence = sequence
113   @options = options
114 end
output(sequence, options = {}) click to toggle source

Returns a formatterd string of the given sequence


Arguments:

  • (required) sequence: Bio::Sequence object

  • (optional) options: a Hash object

Returns

String object

   # File lib/bio/sequence/format.rb
91 def self.output(sequence, options = {})
92   self.new(sequence, options).output
93 end

Private Class Methods

erb_template(str) click to toggle source

register new Erb template

    # File lib/bio/sequence/format.rb
 96 def self.erb_template(str)
 97   erb = ERB.new(str)
 98   erb.def_method(self, 'output')
 99   true
100 end

Public Instance Methods

output() click to toggle source

generates output data


Returns

String object

    # File lib/bio/sequence/format.rb
106 def output
107   raise NotImplementedError, 'should be implemented in subclass'
108 end