[BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.7,1.8

Katayama Toshiaki k at pub.open-bio.org
Thu Nov 24 11:19:40 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio/shell
In directory pub.open-bio.org:/tmp/cvs-serv21154/lib/bio/shell

Modified Files:
	core.rb 
Log Message:
* load_object_file/save_objectfile : Every kind of object is now successfully restored.  This idea is contributed by Koichi Sasada. (Previously, this method failed to restore the Bio::GenBank object etc. when it contains unescaped string. Other approach to accomplish this ploblem is to use String#dump method when loading)


Index: core.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** core.rb	14 Nov 2005 02:01:54 -0000	1.7
--- core.rb	24 Nov 2005 16:19:38 -0000	1.8
***************
*** 282,287 ****
          hash.each do |k, v|
            begin
!             # p [k, v, v.class, Marshal.load(v)]
!             eval("#{k} = Marshal.load('#{v}')", bind)
            rescue
              puts "Warning: object '#{k}' couldn't be loaded : #{$!}"
--- 282,287 ----
          hash.each do |k, v|
            begin
!             Thread.current[:restore_value] = v
!             eval("#{k} = Thread.current[:restore_value]", bind)
            rescue
              puts "Warning: object '#{k}' couldn't be loaded : #{$!}"
***************
*** 312,316 ****
              value = eval(elem, bind)
              if value
!               hash[elem] = Marshal.dump(value)
              end
            end
--- 312,316 ----
              value = eval(elem, bind)
              if value
!               hash[elem] = value
              end
            end
***************
*** 326,329 ****
--- 326,330 ----
      end
    end
+ 
  
    ### history



More information about the bioruby-cvs mailing list