[BioRuby-cvs] bioruby/lib/bio/io flatfile.rb,1.45,1.46
Naohisa Goto
ngoto at pub.open-bio.org
Wed Feb 22 10:01:29 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/io
In directory pub.open-bio.org:/tmp/cvs-serv917/lib/bio/io
Modified Files:
flatfile.rb
Log Message:
in Bio::FlatFile::AutoDetect#autodetect_flatfile calls autodetect
rules before reading the stream if meta information (file path, etc)
is available.
Index: flatfile.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile.rb,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** flatfile.rb 22 Feb 2006 09:15:22 -0000 1.45
--- flatfile.rb 22 Feb 2006 10:01:27 -0000 1.46
***************
*** 989,994 ****
# Returns nil if failed.
def autodetect_flatfile(ff, lines = 31)
stream = ff.instance_eval { @stream }
! meta = { :path => stream.path }
1.upto(lines) do |x|
break unless line = stream.prefetch_gets
--- 989,1006 ----
# Returns nil if failed.
def autodetect_flatfile(ff, lines = 31)
+ meta = {}
stream = ff.instance_eval { @stream }
! begin
! path = stream.path
! rescue NameError
! end
! if path then
! meta[:path] = path
! # call autodetect onece with meta and without any read action
! if r = self.autodetect(stream.prefetch_buffer, meta)
! return r
! end
! end
! # reading stream
1.upto(lines) do |x|
break unless line = stream.prefetch_gets
More information about the bioruby-cvs
mailing list