[BioRuby-cvs] bioruby/lib/bio reference.rb,1.27,1.28

Naohisa Goto ngoto at dev.open-bio.org
Mon Jun 2 09:47:11 UTC 2008


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

Modified Files:
	reference.rb 
Log Message:
* New method Bio::Reference#pubmed_url added (renamed the url method in
  revision 1.25).
* Bio::Reference#endnote is changed not to overwrite url if url is
  already given by user.


Index: reference.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** reference.rb	2 Jun 2008 09:33:48 -0000	1.27
--- reference.rb	2 Jun 2008 09:47:08 -0000	1.28
***************
*** 232,241 ****
        lines << "%P #{@pages}" unless @pages.empty?
        lines << "%M #{@pubmed}" unless @pubmed.to_s.empty?
!       if @pubmed
!         cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi"
!         opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids"
!         @url = "#{cgi}?#{opts}=#{@pubmed}"
!       end
!       lines << "%U #{@url}" unless @url.empty?
        lines << "%X #{@abstract}" unless @abstract.empty?
        @mesh.each do |term|
--- 232,237 ----
        lines << "%P #{@pages}" unless @pages.empty?
        lines << "%M #{@pubmed}" unless @pubmed.to_s.empty?
!       url = @url.empty? ? pubmed_url : @url
!       lines << "%U #{url}" unless url.empty?
        lines << "%X #{@abstract}" unless @abstract.empty?
        @mesh.each do |term|
***************
*** 500,503 ****
--- 496,510 ----
      end
  
+     # Returns a valid URL for pubmed records
+     #
+     # *Returns*:: String
+     def pubmed_url
+       unless @pubmed.to_s.empty?
+         cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi"
+         opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids"
+         return "#{cgi}?#{opts}=#{@pubmed}"
+       end
+       ''
+     end
  
      private




More information about the bioruby-cvs mailing list