From: martinahansen Date: Thu, 17 Mar 2011 14:02:17 +0000 (+0000) Subject: ruby cleanup X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6b742d016f0f6faa5e8ec8ea25bceb95c686e12b;p=biopieces.git ruby cleanup git-svn-id: http://biopieces.googlecode.com/svn/trunk@1291 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_ruby/Maasha/lib/bitarray.rb b/code_ruby/Maasha/lib/bitarray.rb index 36f956e..c6a1ebb 100644 --- a/code_ruby/Maasha/lib/bitarray.rb +++ b/code_ruby/Maasha/lib/bitarray.rb @@ -74,7 +74,7 @@ class BitArray # result in a new bit array. Bits are copied if they exists in BOTH operands. # 00111100 & 00001101 = 00001100 def &(ba) - raise BitArrayError, "uneven size of bit arrays: #{self.size} vs #{ba.size}" if self.size != ba.size + raise BitArrayError, "uneven size of bit arrays: #{self.size} != #{ba.size}" if self.size != ba.size result = BitArray.new(ba.size) @@ -89,7 +89,7 @@ class BitArray # result in a new bit array. Bits are copied if they exists in EITHER operands. # 00111100 | 00001101 = 00111101 def |(ba) - raise BitArrayError, "uneven size of bit arrays: #{self.size} vs #{ba.size}" if self.size != ba.size + raise BitArrayError, "uneven size of bit arrays: #{self.size} != #{ba.size}" if self.size != ba.size result = BitArray.new(ba.size) @@ -104,7 +104,7 @@ class BitArray # result in a new bit array. Bits are copied if they exists in ONE BUT NOT BOTH operands. # 00111100 ^ 00001101 = 00110001 def ^(ba) - raise BitArrayError, "uneven size of bit arrays: #{self.size} vs #{ba.size}" if self.size != ba.size + raise BitArrayError, "uneven size of bit arrays: #{self.size} != #{ba.size}" if self.size != ba.size result = BitArray.new(ba.size) @@ -130,6 +130,8 @@ class BitArray string end + alias :to_s :to_string + private # Method to initialize the byte array (string) that constitutes the bit array. diff --git a/code_ruby/Maasha/lib/seq.rb b/code_ruby/Maasha/lib/seq.rb index 6d739b9..a63741f 100644 --- a/code_ruby/Maasha/lib/seq.rb +++ b/code_ruby/Maasha/lib/seq.rb @@ -88,7 +88,7 @@ class Seq self.seq.nil? ? 0 : self.seq.length end - alias len length + alias :len :length # Return the number indels in a sequence. def indels @@ -184,7 +184,7 @@ class Seq self.complement end - alias revcomp reverse_complement + alias :revcomp :reverse_complement # Method to reverse the sequence. def reverse