[BioRuby-cvs] bioruby/lib/bio sequence.rb,0.58.2.2,0.58.2.3

Naohisa Goto ngoto at dev.open-bio.org
Fri Feb 15 03:23:25 UTC 2008


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

Modified Files:
      Tag: BRANCH-biohackathon2008
	sequence.rb 
Log Message:
In Bio::Sequence#method_missing, __send__ should be used instead of 
send. When method is not found, error message is modified if it is 
caused by method_missing.


Index: sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v
retrieving revision 0.58.2.2
retrieving revision 0.58.2.3
diff -C2 -d -r0.58.2.2 -r0.58.2.3
*** sequence.rb	14 Feb 2008 03:13:46 -0000	0.58.2.2
--- sequence.rb	15 Feb 2008 03:23:23 -0000	0.58.2.3
***************
*** 97,101 ****
    # http://www.rubycentral.com/book/ref_c_object.html#Object.method_missing
    def method_missing(sym, *args, &block) #:nodoc:
!     @seq.send(sym, *args, &block)
    end
    
--- 97,119 ----
    # http://www.rubycentral.com/book/ref_c_object.html#Object.method_missing
    def method_missing(sym, *args, &block) #:nodoc:
!     begin
!       @seq.__send__(sym, *args, &block)
!     rescue NoMethodError => evar
!       lineno = __LINE__ - 2
!       file = __FILE__
!       bt_here = [ "#{file}:#{lineno}:in \`__send__\'",
!                   "#{file}:#{lineno}:in \`method_missing\'"
!                 ]
!       if bt_here == evar.backtrace[0, 2] then
!         bt = evar.backtrace[2..-1]
!         evar = NoMethodError.new("undefined method \`#{sym.to_s}\' for #{self.inspect}")
!         evar.set_backtrace(bt)
!       end
!       #p lineno
!       #p file
!       #p bt_here
!       #p evar.backtrace
!       raise(evar)
!     end
    end
    




More information about the bioruby-cvs mailing list