In Files

  • rubygems/source_list.rb

Class/Module Index [+]

Quicksearch

Gem::SourceList

Attributes

sources[R]

Public Class Methods

from(ary) click to toggle source
 
               # File rubygems/source_list.rb, line 10
def self.from(ary)
  list = new

  if ary
    ary.each do |x|
      list << x
    end
  end

  return list
end
            
new() click to toggle source
 
               # File rubygems/source_list.rb, line 4
def initialize
  @sources = []
end
            

Public Instance Methods

<<(obj) click to toggle source
 
               # 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
            
==(other) click to toggle source
 
               # File rubygems/source_list.rb, line 58
def ==(other)
  to_a == other
end
            
delete(uri) click to toggle source
 
               # 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
            
each() click to toggle source
 
               # File rubygems/source_list.rb, line 50
def each
  @sources.each { |s| yield s.uri.to_s }
end
            
each_source(&b) click to toggle source
 
               # File rubygems/source_list.rb, line 54
def each_source(&b)
  @sources.each(&b)
end
            
first() click to toggle source
 
               # File rubygems/source_list.rb, line 68
def first
  @sources.first
end
            
include?(other) click to toggle source
 
               # 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
            
initialize_copy(other) click to toggle source
 
               # File rubygems/source_list.rb, line 22
def initialize_copy(other)
  @sources = @sources.dup
end
            
replace(other) click to toggle source
 
               # File rubygems/source_list.rb, line 40
def replace(other)
  @sources.clear

  other.each do |x|
    self << x
  end

  self
end
            
to_a() click to toggle source
 
               # File rubygems/source_list.rb, line 62
def to_a
  @sources.map { |x| x.uri.to_s }
end
            
Also aliased as: to_ary
to_ary() click to toggle source
Alias for: to_a

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 visit Documenting-ruby.org.

blog comments powered by Disqus