[BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.1,1.2

Katayama Toshiaki k at pub.open-bio.org
Fri Sep 23 23:25:51 EDT 2005


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

Modified Files:
	core.rb 
Log Message:
* Changed not to raise when the object couldn't restored in load_object
  i.e. an instance of user defined class which is not loaded by default.
* Changed not to save object whose value is nil in save_object.


Index: core.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** core.rb	23 Sep 2005 13:57:08 -0000	1.1
--- core.rb	24 Sep 2005 03:25:49 -0000	1.2
***************
*** 237,242 ****
          hash = Marshal.load(File.read(file))
          hash.each do |k, v|
!           # p [k, v, v.class, Marshal.load(v)]
!           eval("#{k} = Marshal.load('#{v}')", bind)
          end
        rescue
--- 237,246 ----
          hash = Marshal.load(File.read(file))
          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 : #{$!}"
!           end
          end
        rescue
***************
*** 262,266 ****
            hash = {}
            list.each do |elem|
!             hash[elem] = Marshal.dump(eval(elem, bind))
            end
            Marshal.dump(hash, f)
--- 266,273 ----
            hash = {}
            list.each do |elem|
!             value = eval(elem, bind)
!             if value
!               hash[elem] = Marshal.dump(value)
!             end
            end
            Marshal.dump(hash, f)



More information about the bioruby-cvs mailing list