From ebebb2fbebded793d93a1e1231364ebaf6d43188 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Fri, 14 May 2010 13:09:25 +0000 Subject: [PATCH] cleaning up ruby code dir git-svn-id: http://biopieces.googlecode.com/svn/trunk@952 74ccb610-7750-0410-82ae-013aeee3265d --- .../lib/{biopieces.rb => biopieces_old.rb} | 0 code_ruby/Maasha/lib/bp_optparse.rb | 58 ------------------- 2 files changed, 58 deletions(-) rename code_ruby/Maasha/lib/{biopieces.rb => biopieces_old.rb} (100%) delete mode 100644 code_ruby/Maasha/lib/bp_optparse.rb diff --git a/code_ruby/Maasha/lib/biopieces.rb b/code_ruby/Maasha/lib/biopieces_old.rb similarity index 100% rename from code_ruby/Maasha/lib/biopieces.rb rename to code_ruby/Maasha/lib/biopieces_old.rb diff --git a/code_ruby/Maasha/lib/bp_optparse.rb b/code_ruby/Maasha/lib/bp_optparse.rb deleted file mode 100644 index 1946fda..0000000 --- a/code_ruby/Maasha/lib/bp_optparse.rb +++ /dev/null @@ -1,58 +0,0 @@ -require 'getoptlong' - -class BP_optparse - attr_accessor :options - - def initialize( options = [] ) - @options = options - end - - # Method that adds default options to the option list. - def add_default_options - @options << { :long => 'help', :short => '?', :type => :flag, :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil } - @options << { :long => 'stream_in', :short => 'I', :type => :file!, :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil } - @options << { :long => 'stream_out', :short => 'O', :type => :file, :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil } - @options << { :long => 'verbose', :short => 'v', :type => :flag, :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil } - end - - # Method to check if the option list contains duplicate long options. - def check_duplicate_long - hash = {} - - @options.each do |opt| - raise ArgumentError, "Duplicate long argument" if hash.include?( opt[ :long ] ) - - hash[ opt[ :long ] ] = true - end - end - - # Method to check if the option list contains duplicate short options. - def check_duplicate_short - hash = {} - - @options.each do |opt| - raise ArgumentError, "Duplicate short argument" if hash.include?( opt[ :short ] ) - - hash[ opt[ :short ] ] = true - end - end - - # Method to prepare the option list into the format of GetoptLong. - def compile_option_list - option_list = [] - - @options.each do |opt| - if opt[ :type ] == :flag - option_list << [ "--#{ opt[ :long ] }", "-#{ opt[ :short ] }", GetoptLong::NO_ARGUMENT ] - else - option_list << [ "--#{ opt[ :long ] }", "-#{ opt[ :short ] }", GetoptLong::REQUIRED_ARGUMENT ] - end - end - - option_list - end - - def parse_options( option_list ) - opts = GetoptLong.new() - end -end -- 2.39.5