@suss/adapter-ruby 0.22.3 → 0.23.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.
- package/README.md +16 -0
- package/dist/index.cjs +476 -213
- package/dist/index.d.cts +41 -4
- package/dist/index.d.ts +41 -4
- package/dist/index.js +478 -214
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -24,6 +24,14 @@ Each branch gets its own `statusCodeReading`, alongside the pattern's `defaultSt
|
|
|
24
24
|
|
|
25
25
|
A branch also gets the calls that reach it. `guardsHoldOn` from `@suss/extractor` decides that, comparing what gates each call against what gates the branch, which is the same test the Python and TypeScript adapters apply.
|
|
26
26
|
|
|
27
|
+
## What runs around an action
|
|
28
|
+
|
|
29
|
+
A pack says which class-level calls put one of a controller's own methods in front of its actions, in `filters` on the `controllerActions` pattern. Each entry gives the call's name, where it names the method (a leading symbol, or a `with:` keyword), whether the library runs it only after the action raised, the call that takes it back off, and the keywords that narrow it to some of the actions. Rails writes those as `before_action`, `rescue_from`, `skip_before_action`, `only:` and `except:`, and none of those words is in this package.
|
|
30
|
+
|
|
31
|
+
A filter is read from the class body and from every ancestor's, most distant first, which is the order the library runs them in. The method it names is looked up the way Ruby looks up a method, so a filter declared on a base class and defined there reaches every controller that inherits it, once, in the file it is written in.
|
|
32
|
+
|
|
33
|
+
Each filter method becomes a `middleware` unit with no boundary. A path through it that writes a response ends the request, and every other path hands the request on, which its `delegate` branches say. `composeWrappers` in `@suss/extractor` folds that unit into each action that records it, so an action reports the filter's 401 under the filter's own test and its own outcomes under the negation of it.
|
|
34
|
+
|
|
27
35
|
## The method behind a field
|
|
28
36
|
|
|
29
37
|
Most fields in a graphql-ruby schema get their value from a method. A summary should say a field has nothing behind it only when the adapter looked and found no such method.
|
|
@@ -118,6 +126,14 @@ through `const_set` or `Object.const_get`, which nothing here reads.
|
|
|
118
126
|
The definitions are collected per file and matched afterwards, since which
|
|
119
127
|
file defines a constant is only settled once every file has been read.
|
|
120
128
|
|
|
129
|
+
A class reached by name rather than by a reading site, which is what an
|
|
130
|
+
ancestry walk does, goes through the naming convention instead: the constant
|
|
131
|
+
underscores to a path, and that path is looked for under the configured root
|
|
132
|
+
and then under each directory directly beneath it. Rails autoloads from every
|
|
133
|
+
directory under `app`, so `ApplicationController` is
|
|
134
|
+
`app/controllers/application_controller.rb`. The root's own file wins where
|
|
135
|
+
both exist, and no other spelling is tried.
|
|
136
|
+
|
|
121
137
|
## What a class inherits
|
|
122
138
|
|
|
123
139
|
A class says which class it extends, twice. `extends` points at whatever the
|