[BioRuby-cvs] bioruby/lib/bio/sequence common.rb,1.5,1.6

Naohisa Goto ngoto at dev.open-bio.org
Thu Dec 27 17:36:04 UTC 2007


Update of /home/repository/bioruby/bioruby/lib/bio/sequence
In directory dev.open-bio.org:/tmp/cvs-serv27687/lib/bio/sequence

Modified Files:
	common.rb 
Log Message:
(ruby 1.9 comliant) in window_search method, changed to avoid shadowing
of local variable by loop local variable.


Index: common.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence/common.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** common.rb	3 Dec 2007 06:19:12 -0000	1.5
--- common.rb	27 Dec 2007 17:36:02 -0000	1.6
***************
*** 178,186 ****
    # *Returns*:: new Bio::Sequence::NA/AA object
    def window_search(window_size, step_size = 1)
!     i = 0
      0.step(self.length - window_size, step_size) do |i| 
        yield self[i, window_size]                        
      end                          
!     return self[i + window_size .. -1] 
    end
  
--- 178,187 ----
    # *Returns*:: new Bio::Sequence::NA/AA object
    def window_search(window_size, step_size = 1)
!     last_step = 0
      0.step(self.length - window_size, step_size) do |i| 
        yield self[i, window_size]                        
+       last_step = i
      end                          
!     return self[last_step + window_size .. -1] 
    end
  




More information about the bioruby-cvs mailing list