Class: TopologicalInventory::Schema::Base

Inherits:
InventoryRefresh::Persister
  • Object
show all
Defined in:
lib/topological_inventory/schema/base.rb

Direct Known Subclasses

Default

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.klass_for(name) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/topological_inventory/schema/base.rb', line 16

def self.klass_for(name)
  klass_name = "TopologicalInventory::Schema::#{name}"
  klass      = klass_name.safe_constantize

  # sometimes autoloader is confused and loads class with another namespace
  # checks whether it loads what we want
  klass if klass.to_s == klass_name
end

Instance Method Details

#to_hashObject



7
8
9
10
11
12
13
14
# File 'lib/topological_inventory/schema/base.rb', line 7

def to_hash
  {
    "schema": {
      "name": self.class.name.split("::").last # schema name
    },
    "source": manager.uid,
  }.merge(super)
end