]> git.donarmstrong.com Git - biopieces.git/commitdiff
ruby cleanup
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 17 Mar 2011 14:02:17 +0000 (14:02 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 17 Mar 2011 14:02:17 +0000 (14:02 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1291 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/Maasha/lib/bitarray.rb
code_ruby/Maasha/lib/seq.rb

index 36f956e3e3a8f5000a030c2441927cc2884e991e..c6a1ebbd66e5a22349b8ad6ca9d18fe6671b1806 100644 (file)
@@ -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.
index 6d739b930850cf556cd1bd17ef0b0a5c448c5794..a63741f5aa8ec22fd38aa7a8f326c4f1fa19073e 100644 (file)
@@ -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