# File rubygems/source_list.rb, line 26
def <<(obj)
src = case obj
when URI
Gem::Source.new(obj)
when Gem::Source
obj
else
Gem::Source.new(URI.parse(obj))
end
@sources << src
src
end
# File rubygems/source_list.rb, line 58
def ==(other)
to_a == other
end
# File rubygems/source_list.rb, line 80
def delete(uri)
if uri.kind_of? Gem::Source
@sources.delete uri
else
@sources.delete_if { |x| x.uri.to_s == uri.to_s }
end
end
# File rubygems/source_list.rb, line 50
def each
@sources.each { |s| yield s.uri.to_s }
end
# File rubygems/source_list.rb, line 54
def each_source(&b)
@sources.each(&b)
end
# File rubygems/source_list.rb, line 72
def include?(other)
if other.kind_of? Gem::Source
@sources.include? other
else
@sources.find { |x| x.uri.to_s == other.to_s }
end
end
# File rubygems/source_list.rb, line 22
def initialize_copy(other)
@sources = @sources.dup
end
# File rubygems/source_list.rb, line 40
def replace(other)
@sources.clear
other.each do |x|
self << x
end
self
end
# File rubygems/source_list.rb, line 62
def to_a
@sources.map { |x| x.uri.to_s }
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.