business_flow 0.9.1 → 0.10.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/Gemfile.lock +1 -1
- data/lib/business_flow/cacheable.rb +8 -5
- data/lib/business_flow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e290b1ee2ae04716265134fba7524c9807aca356
|
4
|
+
data.tar.gz: eac9618cc742dcf1d9414511f16dc9e7b589bfbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e405489e1b36df74ba88023c1a6dab81f70a635caaa0536db9b1939ee5af323e1e1bbc148cb4035af3a51af19c2039e3e553c0b2b3eba31a846fc028d348ae4e
|
7
|
+
data.tar.gz: 9506dd03a58ee98d3e3d24a453c57b766af2710ecb9ee370b2ccda2a76c2dff482b730614b1d91f7a39742a9e56c2f92fdd5bddfe0925152e49949d8f661b924
|
data/Gemfile.lock
CHANGED
@@ -15,11 +15,11 @@ module BusinessFlow
|
|
15
15
|
module ClassMethods
|
16
16
|
# Responsible for converting our DSL options into cache store options
|
17
17
|
CacheOptions = Struct.new(:ttl) do
|
18
|
-
def to_store_options
|
18
|
+
def to_store_options(flow)
|
19
19
|
# compact is not available in Ruby <2.4 or ActiveSupport < 4, so
|
20
20
|
# we can't use it here.
|
21
21
|
options = {}
|
22
|
-
options[:expires_in] = ttl if ttl
|
22
|
+
options[:expires_in] = ttl.call(flow, nil) if ttl
|
23
23
|
options
|
24
24
|
end
|
25
25
|
end
|
@@ -41,8 +41,10 @@ module BusinessFlow
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def cache_ttl(ttl = nil)
|
44
|
-
if ttl
|
45
|
-
cache_options.ttl = ttl
|
44
|
+
if ttl.is_a?(Numeric)
|
45
|
+
cache_options.ttl = proc { ttl }
|
46
|
+
elsif ttl
|
47
|
+
cache_options.ttl = Callable.new(ttl)
|
46
48
|
else
|
47
49
|
cache_options.ttl
|
48
50
|
end
|
@@ -60,7 +62,8 @@ module BusinessFlow
|
|
60
62
|
# as best as I can tell.
|
61
63
|
def execute(flow)
|
62
64
|
add_cache_key_to_result_class
|
63
|
-
cache_store.fetch(flow.cache_key,
|
65
|
+
cache_store.fetch(flow.cache_key,
|
66
|
+
cache_options.to_store_options(flow)) do
|
64
67
|
result = add_cache_key(super(flow), flow)
|
65
68
|
raise FlowFailedException, result if result.errors?
|
66
69
|
result
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: business_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Scarborough
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|