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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 906ebc5d02936ddd4dccc1072c69ac670c355f0b
4
- data.tar.gz: 75ea233a078575ed6a81aa79688e8189d3da95f1
3
+ metadata.gz: e290b1ee2ae04716265134fba7524c9807aca356
4
+ data.tar.gz: eac9618cc742dcf1d9414511f16dc9e7b589bfbe
5
5
  SHA512:
6
- metadata.gz: dacf0e265b3c9554b0b4ba051ab073cff9656629627a4a039880cf03aca028efb733ef3a793178fcdb3269c2c40911708a7df099c8f6055125f0fbb3b2dae72d
7
- data.tar.gz: 0354714d39967dfc9aa211682c77cf919d165bad3f4666f148ec74447df5fa1f4298f3e4e401e659cdfaaa29fe44a135cdb257bafe232e55146949637f25fada
6
+ metadata.gz: e405489e1b36df74ba88023c1a6dab81f70a635caaa0536db9b1939ee5af323e1e1bbc148cb4035af3a51af19c2039e3e553c0b2b3eba31a846fc028d348ae4e
7
+ data.tar.gz: 9506dd03a58ee98d3e3d24a453c57b766af2710ecb9ee370b2ccda2a76c2dff482b730614b1d91f7a39742a9e56c2f92fdd5bddfe0925152e49949d8f661b924
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- business_flow (0.9.1)
4
+ business_flow (0.10.0)
5
5
  activemodel (>= 3.0)
6
6
  activesupport (>= 3.0)
7
7
 
@@ -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, cache_options.to_store_options) do
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
@@ -1,3 +1,3 @@
1
1
  module BusinessFlow
2
- VERSION = '0.9.1'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
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.9.1
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: 2018-12-14 00:00:00.000000000 Z
11
+ date: 2019-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel