Module: Dcmgr::Tags

Includes:
Dcmgr
Defined in:
lib/dcmgr/tags.rb

Defined Under Namespace

Classes: HostPool, NetworkPool, StoragePool

Constant Summary collapse

KEY_MAP =
{10=>:NetworkPool, 11=>:HostPool, 12=>:StoragePool}.freeze
MODEL_MAP =
KEY_MAP.invert.freeze

Constants included from Dcmgr

VERSION, VERSION_MAJOR, VERSION_MINOR

Class Method Summary collapse

Methods included from Dcmgr

conf, configure, initializer_hooks, run_initializers

Class Method Details

.type_id(class_or_sym) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/dcmgr/tags.rb', line 8

def self.type_id(class_or_sym)
  k = case class_or_sym
  when String, Symbol
    class_or_sym.to_sym
  when Class
    class_or_sym.to_s.split('::').last.to_sym
  end

  MODEL_MAP[k] || raise("Unknown key to get type_id: #{class_or_sym}")
end