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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5d020649fc151b8e6cdd45cdd7dbed9c139a47f043a5a77787c224ececb4fa7
4
- data.tar.gz: 24a6a982f2133cafe7d6ee79c86b56420fc7cb48165b6abb6fb3bc5a6cb73874
3
+ metadata.gz: c19d79d32af132f50b5ac87c5255206d6a9b4ea3429e66e71792edf0afda5cdb
4
+ data.tar.gz: 1d16a22fbfc9d2f26c441544b76c91317bad559b7eff38fb67b0986970f0e07d
5
5
  SHA512:
6
- metadata.gz: 98923708de99e83490c25b69b66d2b2915e726e3bb843545c037c07b49f41cfcd64011a8fa626d80af63ffb1a67a534bb8746e37f60d0805abb62ad742db1fe9
7
- data.tar.gz: 59af2628e1969f9653c50fbae80b4d3946fd96aad8e2c5da230cb15b18ed15b98577d869e7052551e36ea5ef37c19d1b3db2d2ebc72236d3218b130030f36c4a
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.
@@ -16,6 +16,6 @@
16
16
 
17
17
  module SnFoil
18
18
  module Controller
19
- VERSION = '1.0.1'
19
+ VERSION = '1.1.0'
20
20
  end
21
21
  end
@@ -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.1
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-05-17 00:00:00.000000000 Z
12
+ date: 2022-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport