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, line 110
def initialize(sequence, options = {})
  @sequence = sequence
  @options = options
end
output(sequence, options = {}) click to toggle source

Returns a formatterd string of the given sequence


Arguments:

Returns

String object

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

Private Class Methods

erb_template(str) click to toggle source

register new Erb template

# File lib/bio/sequence/format.rb, line 95
def self.erb_template(str)
  erb = ERB.new(str)
  erb.def_method(self, 'output')
  true
end

Public Instance Methods

output() click to toggle source

generates output data


Returns

String object

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