short_circu_it 0.5.0 → 0.6.0.pre

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: 592a5e9f48efa007083f97ccf469ab400f526fc3f422a6db53fccd29974548b2
4
- data.tar.gz: 5903506ebb5f4cb60e6e6e9cda050e1b62e3bfd33884fce201ce6c0416378d07
3
+ metadata.gz: b33b859e595e10c199fdd17bd805206e1035e5d879e442386a8d852b3121c44d
4
+ data.tar.gz: a2abbe0325968d9f7e9b0b4b2c14bc2c73e63ecddc0bafa69c2798929942a502
5
5
  SHA512:
6
- metadata.gz: fc96ea51eeec2ad20ec71040b1cf3a5748a84051cb24999618a034d02d97f7bcbf060aefc1431cb9ca32c340abb62afdf94ca315baa74e77dd98c7f112002bbf
7
- data.tar.gz: 71b657f2dc9a749004f69bd5e0df34adae263d9ecfeb6a7dec47a61c7db359a540ab137b3eb9ffa731057eca3a43e460ab32db2abf9f4dd5ff7e5b8a24cab4df
6
+ metadata.gz: 2414b41886dd4acb0f991a5ee4ab2c2a23d60ed508738af91497c61a195ea9b816655624fc767573566d8b41cb52d0757ab9a58d9b69862f4a4a3073cddc9c44
7
+ data.tar.gz: b0a3c74002e77db75b7a204d328a4f48f57eb9e4b0315cf14b3665f59d6be6ec8950b548d841ae9916d3da399c04d6b8294a2883cc0ead8ff3a343490c9cbb25
@@ -66,13 +66,22 @@ module ShortCircuIt
66
66
  # => #<SomeAssociation:2468 id: 2>
67
67
  #
68
68
  # @param method_name [Symbol] The name of the method to be memoized
69
- # @param :observes [Symbol, Array<Symbol>] A method or array of methods to be observed to determine memoization
70
- # cache validity. If any of the observed values change, the cached
71
- # value will be invalidated. By default, the object will observe itself.
72
- def memoize(method_name, observes: :itself)
69
+ # @param :observes [Symbol, Array<Symbol>]
70
+ # A method or array of methods to be observed to determine memoization cache validity.
71
+ # If any of the observed values change, the cached value will be invalidated.
72
+ # By default, the object will observe itself.
73
+ # @param :memoize_subclasses [Boolean]
74
+ # If true, method will be memoized in subclasses that redefine the method.
75
+ # If false, subclasses that redefine the method will not memoizee the resolveed value.
76
+ # Default: false
77
+ def memoize(method_name, observes: :itself, memoize_subclasses: false)
73
78
  add_memoized_observers(method_name.to_sym, observes)
74
79
 
75
- around_method method_name.to_sym, prevent_double_wrapping_for: ShortCircuIt do |*args|
80
+ around_method(
81
+ method_name.to_sym,
82
+ prevent_double_wrapping_for: ShortCircuIt,
83
+ wrap_subclasses: memoize_subclasses,
84
+ ) do |*args|
76
85
  memoization_store.memoize(method_name.to_sym, args.hash) do
77
86
  super(*args)
78
87
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShortCircuIt
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0.pre"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: short_circu_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Rettberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2019-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.5.0
33
+ version: 0.6.0.pre
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.5.0
40
+ version: 0.6.0.pre
41
41
  description: Memoize methods safely with parameter and dependency observation
42
42
  email:
43
43
  - allen.rettberg@freshly.com
@@ -66,9 +66,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - ">"
70
70
  - !ruby/object:Gem::Version
71
- version: '0'
71
+ version: 1.3.1
72
72
  requirements: []
73
73
  rubyforge_project:
74
74
  rubygems_version: 2.7.6