Class: Interfacets::Server::Bus

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_url:, asset_paths:) ⇒ Bus

Returns a new instance of Bus.



12
13
14
15
16
# File 'lib/interfacets/server/bus.rb', line 12

def initialize(root_url:, asset_paths:)
  @registry = Registry.new
  @root_url = root_url
  @asset_paths = asset_paths
end

Instance Attribute Details

#asset_paths ⇒ Object (readonly)

Returns the value of attribute asset_paths.



6
7
8
# File 'lib/interfacets/server/bus.rb', line 6

def asset_paths
  @asset_paths
end

#root_url ⇒ Object (readonly)

Returns the value of attribute root_url.



6
7
8
# File 'lib/interfacets/server/bus.rb', line 6

def root_url
  @root_url
end

Instance Method Details

#build(name:, store:) ⇒ Object



25
26
27
# File 'lib/interfacets/server/bus.rb', line 25

def build(name:, store:)
  registry.build(name, store)
end

#client_system_json(only_facets: false) ⇒ Object



18
19
20
21
22
23
# File 'lib/interfacets/server/bus.rb', line 18

def client_system_json(only_facets: false)
  {
    assets: Assets.bundle(dirs: asset_paths, registry:, only_facets:),
    root_url:
  }
end

#handle(name:, id:, event:) ⇒ Object



29
30
31
# File 'lib/interfacets/server/bus.rb', line 29

def handle(name:, id:, event:)
  registry.load(name, id).handle(event)
end