Sha256: 55ea59a68c767a32934d0aa93cd0cfe1ba06c09d21f1d5ed6d9c9cacb34e3571

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require 'genomer'

class GenomerPluginView < Genomer::Plugin

  def run
    return help if arguments.empty?
    self.class.fetch_view(arguments.shift).new(arguments,flags).run
  end

  def self.fetch_view(view)
    require 'genomer-plugin-view/' + view
    const_get(view.capitalize)
  end

  def self.convert_command_line_flags(flags)
    flags.inject(Hash.new) do |hash,(k,v)|
      k = case k
      when :identifier                then k
      when :prefix                    then k
      when :generate_encoded_features then :encoded
      when :reset_locus_numbering     then :reset
      else nil
      end

      hash[k] = v if k
      hash
    end
  end

  def help
    message = <<-STRING.unindent
      Run `genomer man view COMMAND` to review available formats
      Where COMMAND is one of the following:
    STRING

    message + Dir[File.dirname(__FILE__) + '/genomer-plugin-view/*.rb'].
      map{|f| File.basename(f).gsub('.rb','')}.
      delete_if{|i| i == 'version'}.
      delete_if{|i| i == 'gff_record_helper'}.
      sort.
      map{|i| " " * 2 + i}.
      join("\n") + "\n"
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
genomer-plugin-view-0.1.0 lib/genomer-plugin-view.rb
genomer-plugin-view-0.0.7 lib/genomer-plugin-view.rb
genomer-plugin-view-0.0.6 lib/genomer-plugin-view.rb