Method: Docks::Containers.container_for

Defined in:
lib/docks/containers.rb

.container_for(type = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/docks/containers.rb', line 14

def self.container_for(type = nil)
  if @@container_associations.empty?
    constants.each do |const|
      klass = const_get(const)
      @@container_associations[klass.type.to_sym] = klass if klass.respond_to?(:type)
    end
  end

  type.nil? ? Symbol : @@container_associations.fetch(type.to_sym, Symbol)
end