class Simp::Metadata::Locations

Attributes

component[RW]
locationinfo[RW]

Public Class Methods

new(locationinfo, component) click to toggle source
# File lib/simp/metadata/locations.rb, line 8
def initialize(locationinfo, component)
  @locationinfo = locationinfo
  @component = component
end

Public Instance Methods

[](location) click to toggle source
# File lib/simp/metadata/locations.rb, line 35
def [](location)
  Simp::Metadata::Location.new(locationinfo, data[location], component)
end
data() click to toggle source
# File lib/simp/metadata/locations.rb, line 13
def data
  if locationinfo['locations'].nil?
    [locationinfo['primary_source']] + locationinfo['mirrors']
  else
    locationinfo['locations']
  end
end
each() { |self| ... } click to toggle source
# File lib/simp/metadata/locations.rb, line 29
def each
  data.each_index do |location|
    yield self[location]
  end
end
primary() click to toggle source
# File lib/simp/metadata/locations.rb, line 39
def primary
  retval = find(&:primary)
  if retval.nil?
    if locationinfo.key?('primary_source')
      retval = Simp::Metadata::Location.new(locationinfo, locationinfo['primary_source'], component)
    else
      retval = first
    end
  end
  retval
end
size() click to toggle source
# File lib/simp/metadata/locations.rb, line 25
def size
  data.size
end
to_s() click to toggle source
# File lib/simp/metadata/locations.rb, line 21
def to_s
  data.to_s
end