class Gates::Manifest

Attributes

version_map[RW]

Public Class Methods

new(manifest_hash) click to toggle source
# File lib/gates/manifest.rb, line 5
def initialize(manifest_hash)
  versions = []
  # iterate backward through the versions to be able to associate the
  # predecessor with each
  manifest_hash['versions'].reverse.each do |version_info|
    version = ApiVersion.new
    version.id = version_info['id']
    version.gates = version_info['gates'].map do |gate_info|
      gate = Gate.new
      gate.name = gate_info['name']
      gate
    end
    version.predecessor = versions.first

    versions << version
  end

  self.version_map = {}
  versions.each do |version|
    version_map[version.id] = version
  end
end

Public Instance Methods

[](version_id) click to toggle source
# File lib/gates/manifest.rb, line 28
def [](version_id)
  version_map[version_id]
end