From 4cf3dcf93cf69e4b3e29d59ed7dd81ee74f5e6cf Mon Sep 17 00:00:00 2001 From: martinahansen Date: Fri, 20 Aug 2010 12:40:02 +0000 Subject: [PATCH] shifted ruby biopiece records to use symbols instead of strings git-svn-id: http://biopieces.googlecode.com/svn/trunk@1068 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/swapcase_seq | 2 +- code_ruby/Maasha/lib/biopieces.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bp_bin/swapcase_seq b/bp_bin/swapcase_seq index 4831f2a..cb1989c 100755 --- a/bp_bin/swapcase_seq +++ b/bp_bin/swapcase_seq @@ -38,7 +38,7 @@ bp = Biopieces.new options = bp.parse(ARGV, casts) bp.each_record do |record| - record["SEQ"].swapcase! if record.has_key? "SEQ" + record[:SEQ].swapcase! if record.has_key? :SEQ bp.puts record end diff --git a/code_ruby/Maasha/lib/biopieces.rb b/code_ruby/Maasha/lib/biopieces.rb index 05bc736..22c1b27 100644 --- a/code_ruby/Maasha/lib/biopieces.rb +++ b/code_ruby/Maasha/lib/biopieces.rb @@ -68,7 +68,7 @@ class Biopieces @in.each_line do |line| case line when /^([^:]+): (.*)$/ - record[$1] = $2 + record[$1.to_sym] = $2 when /^---$/ yield record unless record.empty? record = {} @@ -89,7 +89,7 @@ class Biopieces @out = Stream::open(@options, mode="w", @output) unless @out.is_a? IO record.each do |key,value| - @out.print "#{key}: #{value}\n" + @out.print "#{key.to_s}: #{value}\n" end @out.print "---\n" -- 2.39.5