2 RECORD_DELIMITER = "\n---\n"
11 def method_missing( name, *args, &block )
12 if args.empty? && @__hash__.has_key?( name ) then
15 super # get the original exception
20 @__hash__.map { | key, value | "#{ key }: #{ value }" }.join( "\n" ) + RECORD_DELIMITER
29 bp = new( File.open( path ) )
30 yield bp if block_given?
33 # if no block was given, the user wants the BioPieces instance
34 # with a still open File so he can read it, so only close if a block
36 bp.close if block_given?
39 def initialize( stream )
44 @stream.close if @stream.respond_to? :close
48 return unless block = @stream.gets( RECORD_DELIMITER )
50 block.chomp!( RECORD_DELIMITER )
51 data = Hash[ *block.split( /: |\n/, 2 ) ]
56 yield record_get until @stream.eof?
57 self # not to have a messy return value