Class: Bio::References
Overview
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
Defined Under Namespace
Modules: BackwardCompatibility
Instance Attribute Summary collapse
-
#references ⇒ Object
Array of Bio::Reference objects.
Class Method Summary collapse
-
.new(ary = []) ⇒ Object
This method should not be used.
Instance Method Summary collapse
-
#append(reference) ⇒ Object
Add a Bio::Reference object to the container.
-
#each ⇒ Object
Iterate through Bio::Reference objects.
-
#initialize(ary = []) ⇒ References
constructor
Normally, users can not call this method.
Constructor Details
#initialize(ary = []) ⇒ References
Normally, users can not call this method.
Create a new Bio::References object
refs = Bio::References.new
Arguments:
-
(optional) __: Array of Bio::Reference objects
- Returns
-
Bio::References object
95 96 97 |
# File 'lib/bio/compat/references.rb', line 95 def initialize(ary = []) @references = ary end |
Instance Attribute Details
#references ⇒ Object
Array of Bio::Reference objects
84 85 86 |
# File 'lib/bio/compat/references.rb', line 84 def references @references end |
Class Method Details
.new(ary = []) ⇒ Object
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
77 78 79 80 81 |
# File 'lib/bio/compat/references.rb', line 77 def self.new(ary = []) warn 'Bio::References is obsoleted. Some methods are added to given array to keep backward compatibility.' ary.extend(BackwardCompatibility) ary end |
Instance Method Details
#append(reference) ⇒ Object
Add a Bio::Reference object to the container.
refs.append(reference)
Arguments:
-
(required) reference: Bio::Reference object
- Returns
-
current Bio::References object
107 108 109 110 |
# File 'lib/bio/compat/references.rb', line 107 def append(reference) @references.push(reference) if reference.is_a? Reference return self end |
#each ⇒ Object
Iterate through Bio::Reference objects.
refs.each do |reference|
...
end
- Block
-
yields each Bio::Reference object
119 120 121 122 123 |
# File 'lib/bio/compat/references.rb', line 119 def each @references.each do |reference| yield reference end end |