card-mod-virtual 0.14.2 → 0.15.0

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/lib/card/virtual.rb +11 -2
  3. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f51deecf4c604d9f01f6005177e6e8e40e03e4e06fb65ffea94c7b7ed330fc8
4
- data.tar.gz: 7ffa17c1ca88784ec32cdeedb2d76422152c89f12c440b69637297a0606792c5
3
+ metadata.gz: a61ee49e35fdc8e28aea81272b0384db3ddf3cb6d5890e76508417e6f09db5ca
4
+ data.tar.gz: 1315611421a3d3a4b57cf647cb1d8c17ddde97437f40cfe73e11798e0cc70770
5
5
  SHA512:
6
- metadata.gz: 81a38c4264f6b5bc9466f37fa59738f5bf063759ae51af9102662a445d229dab457b45ea505f7abda8911e0edba86d72f2b97ad75e4ea4ea3a05484a2f55239e
7
- data.tar.gz: d6f70615d3288ca37d7137fe0563a0c05d2057e127d28aff528c0732e8f7af1993949999977c4c28f7b9d547fb4e9b64f92efea07bcb35113435c4da555fa195
6
+ metadata.gz: '024800b8b21bc6096a71733b8b5b67aa6f5f93bb413fd1fe84f4830cf2a4ee3ea280dd3a2946cb4a7c6af85e7283bb04d21baa4eefeaed91ebd394bc2606dcdc'
7
+ data.tar.gz: c3d5efe0b15a73ef17dddb7b1eac9bc6a1eebda2bbcedb22c4707ef5bf794b4a8c0bcbea51d91a111a32c417d2006ca9e4ae1bc0d09b2e74fade41a3b55a8e27
data/lib/card/virtual.rb CHANGED
@@ -18,16 +18,25 @@ class Card
18
18
  end
19
19
 
20
20
  def save card
21
- virt = find_by_card card
22
- virt ? virt.update(card.virtual_content) : create(card)
21
+ cache.write card.key, create_or_update(card)
23
22
  end
24
23
 
25
24
  def delete card
25
+ cache.delete card.key
26
26
  find_by_card(card)&.delete
27
27
  end
28
28
 
29
29
  private
30
30
 
31
+ def create_or_update card
32
+ if (virt = find_by_card card)
33
+ virt.update(card.virtual_content)
34
+ virt
35
+ else
36
+ create(card)
37
+ end
38
+ end
39
+
31
40
  def cache
32
41
  Card::Cache[Virtual]
33
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-virtual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-08 00:00:00.000000000 Z
13
+ date: 2023-01-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.104.2
21
+ version: 1.105.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.104.2
28
+ version: 1.105.0
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org
@@ -45,6 +45,7 @@ metadata:
45
45
  wiki_uri: https://decko.org
46
46
  documentation_url: http://docs.decko.org/
47
47
  card-mod: virtual
48
+ card-mod-group: gem-defaults
48
49
  post_install_message:
49
50
  rdoc_options: []
50
51
  require_paths:
@@ -60,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  - !ruby/object:Gem::Version
61
62
  version: '0'
62
63
  requirements: []
63
- rubygems_version: 3.2.15
64
+ rubygems_version: 3.3.11
64
65
  signing_key:
65
66
  specification_version: 4
66
67
  summary: virtual