class PrismQA::AppImageSet

App image sets are tied to a target

Attributes

target[RW]

Public Instance Methods

allow(image) click to toggle source
# File gem/lib/prism_qa/imageset.rb, line 94
def allow(image)
  # no duplicates
  if @images.map(&:id).include? image.id
    raise OperationalError, "Tried to add an image with duplicate ID '#{image.id}'"
  end

  # App image sets don't need to worry about specific fields, but we keep it clean and symmetric.
  raise IncompatibilityError, 'Tried to add a DesignImage object to a non- DesignImageSet' if image.is_a? DesignImage
end
best_image_for(id) click to toggle source
# File gem/lib/prism_qa/imageset.rb, line 115
def best_image_for(id)
  cache_image_lookups
  @image_lookup.fetch(id.to_s, nil)
end
cache_image_lookups() click to toggle source
# File gem/lib/prism_qa/imageset.rb, line 104
def cache_image_lookups
  return if @cache_valid

  @image_lookup = {}
  @images.each do |img|
    @image_lookup[img.id.to_s] = img
  end

  @cache_valid = true
end