[BioRuby-cvs] bioruby/lib/bio db.rb,0.35,0.36

Katayama Toshiaki k at dev.open-bio.org
Mon Jan 15 04:33:54 UTC 2007


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

Modified Files:
	db.rb 
Log Message:
* lines_fetch method is refined to concatenate indented sub field


Index: db.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db.rb,v
retrieving revision 0.35
retrieving revision 0.36
diff -C2 -d -r0.35 -r0.36
*** db.rb	19 Sep 2006 06:14:18 -0000	0.35
--- db.rb	15 Jan 2007 04:33:52 -0000	0.36
***************
*** 221,230 ****
    # Returns an Array containing each line of the field without a tag.
    # lines_fetch also stores the result in the @data hash.
!   def lines_fetch(tag) 
!     unless @data[tag]  
!       @data[tag] = get(tag).split(/\n/).map{ |l| tag_cut(l) }  
!     end  
!     @data[tag]  
!   end 
  
  end # class DB
--- 221,245 ----
    # Returns an Array containing each line of the field without a tag.
    # lines_fetch also stores the result in the @data hash.
!   def lines_fetch(tag)
!     unless @data[tag]
!       list = []
!       lines = get(tag).split(/\n/)
!       lines.each do |line|
!         data = tag_cut(line)
!         if data[/^\S/]                  # next sub field
!           list << data
!         else                            # continued sub field
!           data.strip!
!           if list.last[/\-$/]           # folded
!             list[-1] += data
!           else
!             list[-1] += " #{data}"     # rest of list
!           end
!         end
!       end
!       @data[tag] = list
!     end
!     @data[tag]
!   end
  
  end # class DB




More information about the bioruby-cvs mailing list