Class: Interfacets::Server::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/interfacets/server/registry.rb

Defined Under Namespace

Classes: Channel

Instance Method Summary collapse

Instance Method Details

#build(name, store) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/interfacets/server/registry.rb', line 31

def build(name, store)
  facet = name.is_a?(Module) ? name : Object.const_get(name)

  Api.new(
    registry: self,
    name:,
    entity: (
      facet
        .server_entity_class
        .new(
          store: store.is_a?(Hash) ? OpenStruct.new(store) : store,
          nesting: "root",
          parent: nil,
          channel: Channel.new(registry: self)
        )
    )
  )
end