hub_kernel 0.5.0 → 0.6.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 +16 -0
- data/lib/hub_kernel/exposes.rb +15 -0
- data/lib/hub_kernel/version.rb +1 -1
- data/lib/hub_kernel.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04f59c358a3f035fa56669fe9c6da01ceb7a8e513493ad6ca29b108758510d9c
|
|
4
|
+
data.tar.gz: 47a75f20985cf4ce0291e61e389d421245c93e90a3e04255ed69af769dc18469
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4cbcfba750818bdf25789490618b5959effc5af6a7aaca97daf17a7571162c25c35f452a2b26291ad62b7affaf74fc52a195ba65fbb00129fe09bed16e51f12f
|
|
7
|
+
data.tar.gz: 84909e946aac47038945054c3f8548170417388d4af2f96cef7826460385a49e57dc1bf587df6051d5acec6ab57d7355e91b400f9cba29c0306f1d5dcc988dad
|
data/README.md
CHANGED
|
@@ -61,6 +61,22 @@ end
|
|
|
61
61
|
The test fails and names each port the app left unfilled, and each port filled with
|
|
62
62
|
something that cannot be called.
|
|
63
63
|
|
|
64
|
+
### The exposed list
|
|
65
|
+
A hub names each method outside callers may reach, the values it takes, and whether it
|
|
66
|
+
writes. A layer such as a JSON endpoint looks a method up by name and serves only what
|
|
67
|
+
the hub exposes:
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
module Supplies
|
|
71
|
+
extend HubKernel::Exposes
|
|
72
|
+
|
|
73
|
+
exposes :record_purchase, takes: %i[supplier_id bought_on lines], writes: true
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
Supplies.exposed("record_purchase").takes # => [:supplier_id, :bought_on, :lines]
|
|
77
|
+
Supplies.exposed("delete_everything") # => nil
|
|
78
|
+
```
|
|
79
|
+
|
|
64
80
|
## Installation
|
|
65
81
|
Add this line to your application's Gemfile:
|
|
66
82
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module HubKernel
|
|
2
|
+
module Exposes
|
|
3
|
+
Exposed = Data.define(:name, :takes, :writes)
|
|
4
|
+
|
|
5
|
+
def exposes(name, takes:, writes:)
|
|
6
|
+
exposed_methods[name.to_s] = Exposed.new(name: name, takes: takes, writes: writes)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def exposed(name) = exposed_methods[name.to_s]
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def exposed_methods = @exposed_methods ||= {}
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/hub_kernel/version.rb
CHANGED
data/lib/hub_kernel.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hub_kernel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tylercschneider
|
|
@@ -45,6 +45,7 @@ files:
|
|
|
45
45
|
- lib/hub_kernel/conformance/partial.rb
|
|
46
46
|
- lib/hub_kernel/context.rb
|
|
47
47
|
- lib/hub_kernel/engine.rb
|
|
48
|
+
- lib/hub_kernel/exposes.rb
|
|
48
49
|
- lib/hub_kernel/follow_up.rb
|
|
49
50
|
- lib/hub_kernel/hubs.rb
|
|
50
51
|
- lib/hub_kernel/markup.rb
|