hub_kernel-interface 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/lib/hub_kernel/interface/version.rb +1 -1
- data/lib/hub_kernel/interface.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa94379e01e0ee039f41a4781b67f39ad4ad030ec77f0b4782f7c567b74a8002
|
|
4
|
+
data.tar.gz: 3b589b03f7b4ebe8d853943297e617aa9179d00fc53d3c0bd46ee428e3f5ca5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c4701fdf78fe037fdaf67ac3694ba07ff7d1c6d7bf4479bded9f131f56a886876feba0334cf89a6328da5604a621bec573261d9ff31d6e4b18a5850909d9e6f
|
|
7
|
+
data.tar.gz: d087e461324a72ac89c1262dd9bae5d84abde0af484a2c894b38b72bb7f8063c604a30a93d8b44947d9b6b83686b95373e196aa2bc725b76ef89318c943c9826
|
data/README.md
CHANGED
|
@@ -40,9 +40,11 @@ for a missing person, account or required value. A hub refuses with `HubKernel::
|
|
|
40
40
|
reason a person can read. A call made while the permission check or the account scope is unset
|
|
41
41
|
raises `HubKernel::UnwiredPortError`.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Every interface serves every hub that exposes a method, each at its module name in snake
|
|
44
|
+
case, unless the host names the hubs to serve, once. A hub listed alone is served at its
|
|
44
45
|
module name in snake case, and a hub listed as a one-pair hash is served only at the name
|
|
45
|
-
given.
|
|
46
|
+
given. Setting the list to `nil` serves every exposing hub again. An interface gem finds the
|
|
47
|
+
hub served at a name, or `nil` when none is:
|
|
46
48
|
|
|
47
49
|
```ruby
|
|
48
50
|
HubKernel::Interface.hubs = [ Supplies, { "money" => Billing::Ledger } ]
|
|
@@ -55,6 +57,14 @@ HubKernel::Interface.served # => { "supplies" => Supplies, "money" =>
|
|
|
55
57
|
The permission check is still asked about a hub served under a chosen name by its own name,
|
|
56
58
|
such as `ledger:record_spend`.
|
|
57
59
|
|
|
60
|
+
The host names the methods that give the calling person and account once, here, for an
|
|
61
|
+
interface gem to read:
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
HubKernel::Interface.person_method = :hub_person
|
|
65
|
+
HubKernel::Interface.account_method = :hub_account
|
|
66
|
+
```
|
|
67
|
+
|
|
58
68
|
An interface gem's boot check runs `HubKernel::Interface.check!`, which raises
|
|
59
69
|
`HubKernel::Interface::UnservableHubError` naming every problem in the served list at once:
|
|
60
70
|
an entry that exposes no methods, two entries that answer at the same name, and each
|
data/lib/hub_kernel/interface.rb
CHANGED
|
@@ -2,6 +2,7 @@ require "hub_kernel/interface/version"
|
|
|
2
2
|
require "hub_kernel/interface/hub_kernel_release"
|
|
3
3
|
HubKernel::Interface::HubKernelRelease.refuse_older!(Gem.loaded_specs["hub_kernel"])
|
|
4
4
|
require "hub_kernel/exposes"
|
|
5
|
+
require "hub_kernel/interface/exposing_hubs"
|
|
5
6
|
require "hub_kernel/interface/call_reasons"
|
|
6
7
|
|
|
7
8
|
module HubKernel
|
|
@@ -9,8 +10,9 @@ module HubKernel
|
|
|
9
10
|
class UnservableHubError < StandardError; end
|
|
10
11
|
|
|
11
12
|
singleton_class.attr_writer :hubs
|
|
13
|
+
singleton_class.attr_accessor :person_method, :account_method
|
|
12
14
|
|
|
13
|
-
def self.hubs = @hubs
|
|
15
|
+
def self.hubs = @hubs || ExposingHubs.list.dup
|
|
14
16
|
|
|
15
17
|
def self.find(name) = served[name]
|
|
16
18
|
|