[BioRuby-cvs] bioruby/lib/bio reference.rb,1.24.2.3,1.24.2.4
Naohisa Goto
ngoto at dev.open-bio.org
Tue Mar 4 10:07:51 UTC 2008
Update of /home/repository/bioruby/bioruby/lib/bio
In directory dev.open-bio.org:/tmp/cvs-serv7295/lib/bio
Modified Files:
Tag: BRANCH-biohackathon2008
reference.rb
Log Message:
Bio::References and backward-compatibility module (renamed to Bio::References::BackwardCompatibility) is moved to lib/bio/compat/references.rb
Index: reference.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v
retrieving revision 1.24.2.3
retrieving revision 1.24.2.4
diff -C2 -d -r1.24.2.3 -r1.24.2.4
*** reference.rb 28 Feb 2008 05:51:03 -0000 1.24.2.3
--- reference.rb 4 Mar 2008 10:07:49 -0000 1.24.2.4
***************
*** 578,680 ****
end
- # = 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))
- # refs.each do |reference|
- # ...
- # end
- #
- 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
-
- # Create a new Bio::References object
- #
- # refs = Bio::References.new
- # ---
- # *Arguments*:
- # * (optional) __: Array of Bio::Reference objects
- # *Returns*:: Bio::References object
- def initialize(ary = [])
- @references = ary
- end
-
-
- # Add a Bio::Reference object to the container.
- #
- # refs.append(reference)
- # ---
- # *Arguments*:
- # * (required) _reference_: Bio::Reference object
- # *Returns*:: current Bio::References object
- def append(reference)
- @references.push(reference) if reference.is_a? Reference
- return self
- end
-
- # Iterate through Bio::Reference objects.
- #
- # refs.each do |reference|
- # ...
- # end
- # ---
- # *Block*:: yields each Bio::Reference object
- def each
- @references.each do |reference|
- yield reference
- end
- end
-
- end
-
end
--- 578,581 ----
More information about the bioruby-cvs
mailing list