transdeal 0.2.0 → 0.2.1
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/Gemfile.lock +1 -1
- data/README.md +24 -0
- data/lib/transdeal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b13228981483f9cc08900966014106501f0560c0
|
4
|
+
data.tar.gz: fd5ab256980a2b142e367731aa34b5712979a539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54067a97d683cc7fc53c6e5b3578408a1ce1c9cabbf464f8822568bcc88b08914771cda3467052985dbb6cde5f01df2c0c847e79f1e127f532fadd2c4e6c9452
|
7
|
+
data.tar.gz: faa3209ae34f9e989e86f48f4f4bc1bdf4f4fd4e0ec3e5cf9fdbcc30f98ee546fd0b3fed760fc7fc556b6db80a98856361ad987e808341ba05b8159c0efb0224
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -43,6 +43,30 @@ end
|
|
43
43
|
The above will call a configured backend(s) with the last version of modified
|
44
44
|
objects before the transaction is rolled back.
|
45
45
|
|
46
|
+
### Explicit handlers
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
class CallbackHandler
|
50
|
+
def self.run(data)
|
51
|
+
puts data.inspect
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
Transdeal.transaction(users.main, callback: :callback_handler) do
|
56
|
+
users.main = :me
|
57
|
+
raise ActiveRecord::Rollback
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
There are two keyword parameters currently accepted:
|
62
|
+
|
63
|
+
* `callback` — anything that can be converted to proc, or symbol for the class
|
64
|
+
name, or a string, or a class (the class must respond to one of
|
65
|
+
`[:store, :run, :perform_async, :perform, :call, :[]]`—tried
|
66
|
+
in descending order,) or hash `{receiver: ..., method: ...}`
|
67
|
+
* `skip_global_callbacks` — the callbacks configured through global
|
68
|
+
`Transdeal.configure` method will be skipped.
|
69
|
+
|
46
70
|
## Contributing
|
47
71
|
|
48
72
|
Bug reports and pull requests are welcome on GitHub at https://github.com/am-kantox/transdeal. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/transdeal/version.rb
CHANGED