[BioRuby-cvs] bioruby/lib/bio reference.rb,1.24.2.1,1.24.2.2

Naohisa Goto ngoto at dev.open-bio.org
Wed Feb 20 17:04:49 UTC 2008


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

Modified Files:
      Tag: BRANCH-biohackathon2008
	reference.rb 
Log Message:
Bio::References#new is added not to create Bio::References instances anymore.
New transitional module Bio::References::BackwardCompatibilityForBioReferences 
is added to help keeping backward compatibility.
(The only reason why not to erase Bio::References class is to load
Marshal.dump data.)


Index: reference.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v
retrieving revision 1.24.2.1
retrieving revision 1.24.2.2
diff -C2 -d -r1.24.2.1 -r1.24.2.2
*** reference.rb	18 Feb 2008 15:44:39 -0000	1.24.2.1
--- reference.rb	20 Feb 2008 17:04:47 -0000	1.24.2.2
***************
*** 580,587 ****
--- 580,593 ----
    # = DESCRIPTION
    #
+   # This class is OBSOLETED, and will soon be removed.
+   # Instead of this class, an array is to be used.
+   #
+   # 
    # A container class for Bio::Reference objects.
    #
    # = USAGE
    #
+   # This class should NOT be used.
+   #
    #   refs = Bio::References.new
    #   refs.append(Bio::Reference.new(hash))
***************
*** 591,596 ****
    #
    class References
!     include Enumerable
!     
      # Array of Bio::Reference objects
      attr_accessor :references
--- 597,638 ----
    #
    class References
! 
!     # module to keep backward compatibility with obsoleted Bio::References
!     module BackwardCompatibilityForBioReferences #:nodoc:
! 
!       # Backward compatibility with Bio::References#references.
!       # Now, references are stored in an array, and
!       # you should change your code not to use this method.
!       def references
!         warn 'Bio::References is obsoleted. Now, references are stored in an array.'
!         self
!       end
! 
!       # Backward compatibility with Bio::References#append.
!       # Now, references are stored in an array, and
!       # you should change your code not to use this method.
!       def append(reference)
!         warn 'Bio::References is obsoleted. Now, references are stored in an array.'
!         self.push(reference) if reference.is_a? Reference
!         self
!       end
!     end #module BackwardCompatibilityForBioReferences
! 
!     # This method should not be used.
!     # Only for backward compatibility of existing code.
!     #
!     # Since Bio::References is obsoleted,
!     # Bio::References.new not returns Bio::References object,
!     # but modifies given _ary_ and returns the _ary_.
!     #
!     # *Arguments*:
!     # * (optional) __: Array of Bio::Reference objects
!     # *Returns*:: the given array
!     def self.new(ary = [])
!       warn 'Bio::References is obsoleted. Some methods are added to given array to keep backward compatibility.'
!       ary.extend(BackwardCompatibilityForBioReferences)
!       ary
!     end
! 
      # Array of Bio::Reference objects
      attr_accessor :references




More information about the bioruby-cvs mailing list