class Gem::SourceList
def self.from(ary)
def self.from(ary) list = new list.replace ary list end
def <<(obj)
def <<(obj) src = case obj when Gem::Source obj else Gem::Source.new(obj) end @sources << src unless @sources.include?(src) src end
def ==(other) # :nodoc:
def ==(other) # :nodoc: to_a == other end
def clear
def clear @sources.clear end
def delete(source)
def delete(source) if source.is_a? Gem::Source @sources.delete source else @sources.delete_if {|x| x.uri.to_s == source.to_s } end end
def each
def each @sources.each {|s| yield s.uri.to_s } end
def each_source(&b)
def each_source(&b) @sources.each(&b) end
def empty?
def empty? @sources.empty? end
def first
def first @sources.first end
def include?(other)
def include?(other) if other.is_a? Gem::Source @sources.include? other else @sources.find {|x| x.uri.to_s == other.to_s } end end
def initialize
def initialize @sources = [] end
def initialize_copy(other) # :nodoc:
def initialize_copy(other) # :nodoc: @sources = @sources.dup end
def replace(other)
def replace(other) clear other.each do |x| self << x end self end
def to_a
def to_a @sources.map {|x| x.uri.to_s } end