card-mod-solid_cache 0.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/set/abstract/solid_cache.rb +13 -8
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b322e3029fa67070e6c4cba4bfe4713367188fc3b3322010df453960776d2b8
4
- data.tar.gz: 5ec067371aac1ce2ee721bd011a788f93f5aa790c5bdd0689f284dc040fe9e2c
3
+ metadata.gz: be0e802e99fb823a83626b2c80433405d182f4101e6d8f9c25f12018ab412533
4
+ data.tar.gz: 729f3a3588fbebbba2053396a7a7a41b0b9dc4068556767e9f3b0a61cc4f5b14
5
5
  SHA512:
6
- metadata.gz: f6feb7d1863300120d5980f60fac939b3c2b83da0b20169afdc5cc156d31f81494a5351797f5161fbf4ef506b518a1f13d571266ff36e8d979f9f696e2886cef
7
- data.tar.gz: 31e92670dcb54408bbd6b1d828fe0c12496b5a22378314bc6d1c028327eec22d196d3a8207e85faf5a474195345a9bbdba4cadbe87c8f1d8575c79f4d8752855
6
+ metadata.gz: 4955db383c643fe80a721e76d12563159f49064f935e3e309e738dd47c4bdb5c134594c6e93311f63fccd3ef4a839dc0915c01e94b38283ef746e3485c056448
7
+ data.tar.gz: b104642c95a8b1e7e8431cd75430ad085aaa4ef13bfc14b830dec9f646028027efce5f80cdd81cf60f45c4b58b0bea8dae4cd3006965b882fb666b2e1f19a8e5
@@ -8,7 +8,7 @@
8
8
  # The cache expiration can be controlled with the cache_update_trigger and
9
9
  # cache_expire_trigger methods.
10
10
 
11
- card_accessor :solid_cache, type: HtmlID
11
+ card_accessor :solid_cache, type: :html
12
12
 
13
13
  class << self
14
14
  def included host_class
@@ -59,11 +59,8 @@ module ClassMethods
59
59
 
60
60
  def define_event_to_update_expired_cached_cards set_of_changed_card, args,
61
61
  method_name
62
- args[:on] ||= %i[create update delete]
63
- name = event_name set_of_changed_card, args
64
- stage = args[:in_stage] || :integrate
65
- Card::Set.register_set set_of_changed_card
66
- set_of_changed_card.event name, stage, args do
62
+
63
+ update_solid_cache_event set_of_changed_card, args do
67
64
  Array.wrap(yield(self)).compact.each do |expired_cache_card|
68
65
  next unless expired_cache_card.solid_cache?
69
66
  expired_cache_card.send method_name
@@ -71,9 +68,17 @@ module ClassMethods
71
68
  end
72
69
  end
73
70
 
71
+ def update_solid_cache_event set_of_changed_card, args, &block
72
+ args[:on] ||= %i[create update delete]
73
+ name = event_name set_of_changed_card, args
74
+ stage = args[:in_stage] || :integrate
75
+ Card::Set.register_set set_of_changed_card
76
+ set_of_changed_card.event name, stage, args, &block
77
+ end
78
+
74
79
  def event_name set, args
75
- changed_card_set = set.underscore
76
- solid_cache_set = underscore + "__solid_cache"
80
+ changed_card_set = set.underscored_name
81
+ solid_cache_set = underscored_name + "__solid_cache"
77
82
  actions = Array.wrap(args[:on]).join("_")
78
83
  ["update", solid_cache_set,
79
84
  "changed_by", changed_card_set,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-solid_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Kühl
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-26 00:00:00.000000000 Z
12
+ date: 2023-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: card
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.2.28
59
+ rubygems_version: 3.2.33
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: solid cache