Class: EacLauncher::Context::InstanceManager::CachedInstances

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_launcher/context/instance_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ CachedInstances

Returns a new instance of CachedInstances.



74
75
76
77
# File 'lib/eac_launcher/context/instance_manager.rb', line 74

def initialize(content)
  @content = content
  @instances = {}
end

Instance Method Details

#by_logical_path(key) ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/eac_launcher/context/instance_manager.rb', line 83

def by_logical_path(key)
  return @instances[key] if @instances.key?(key)

  h = @content[key]
  parent_instance = h[:parent] ? by_logical_path(h[:parent]) : nil
  path = ::EacLauncher::Paths::Logical.from_h(@context, h)
  @instances[key] = ::EacLauncher::Instances::Base.instanciate(path, parent_instance)
end

#instancesObject



79
80
81
# File 'lib/eac_launcher/context/instance_manager.rb', line 79

def instances
  @content.keys.map { |k| by_logical_path(k) }
end