snfoil-controller 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/snfoil/controller/version.rb +1 -1
- data/lib/snfoil/controller.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c19d79d32af132f50b5ac87c5255206d6a9b4ea3429e66e71792edf0afda5cdb
|
4
|
+
data.tar.gz: 1d16a22fbfc9d2f26c441544b76c91317bad559b7eff38fb67b0986970f0e07d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f14663f15a5801f484c3b1da9a9de6c543361d1d2c2ae6c65b1157c5e8d7ed4edb673001191c8321e7f39bf82c1ea45ece42d49c1ed36f20bdc68b6cc2c053a
|
7
|
+
data.tar.gz: 9d80c20863078b3ecb2f257335aa8060046b1e78e867642edf04605e43a85fa6e3c940793ba2608f5712786de7c0f8ae7b58c0023f485b0d228f2a7e823cb85e
|
data/README.md
CHANGED
@@ -208,6 +208,18 @@ end
|
|
208
208
|
</tbody>
|
209
209
|
</table>
|
210
210
|
|
211
|
+
You can directly call the context using the `#run_context` method and pass it the options. It will automatically process either the `:context_action` or the `:controller_action` from the options. This can be overridden by passing a method name to `#run_context`.
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
...
|
215
|
+
context PeopleContext
|
216
|
+
|
217
|
+
def some_method(**options)
|
218
|
+
run_context(:elevate, **options) #=> Calls PeopleContext#elevate
|
219
|
+
end
|
220
|
+
...
|
221
|
+
```
|
222
|
+
|
211
223
|
#### Serializer
|
212
224
|
|
213
225
|
The main serializer intended to be called by the Controller. Also the default serializer and block used by the '#serialize` method.
|
data/lib/snfoil/controller.rb
CHANGED
@@ -103,10 +103,10 @@ module SnFoil
|
|
103
103
|
exec_deserialize(deserializer, params, **options)
|
104
104
|
end
|
105
105
|
|
106
|
-
def run_context(**options)
|
106
|
+
def run_context(method = nil, **options)
|
107
107
|
(options[:context] || self.class.snfoil_context)
|
108
108
|
.new(entity: entity)
|
109
|
-
.send(options[:context_action] || options[:controller_action], **options)
|
109
|
+
.send(method || options[:context_action] || options[:controller_action], **options)
|
110
110
|
end
|
111
111
|
|
112
112
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snfoil-controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Howes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|