card-mod-virtual 0.14.1 → 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: 1faaea40397c0d5da4eb68f26af697f89f80c38f26185988cac81f01eb0cc938
4
- data.tar.gz: 1a5e126f6857daff50088c18e6401b5d9d56c831b4c0b1da56cd0d0b05db6419
3
+ metadata.gz: a61ee49e35fdc8e28aea81272b0384db3ddf3cb6d5890e76508417e6f09db5ca
4
+ data.tar.gz: 1315611421a3d3a4b57cf647cb1d8c17ddde97437f40cfe73e11798e0cc70770
5
5
  SHA512:
6
- metadata.gz: 1c76342d146a4fc7d1c17c20b42716971c84f23111b8939d15770041f0f367c463444033f6654a0dcbcdbd8a0ab2755c7e9b586325d6123be082efc3728f6963
7
- data.tar.gz: 8d959e2aa0ce142094980c4cdb1abe6a7f2b2df503a4039129b9c41095cb6d0582055f454826e5a574849a4bfc84f02ce90ba275bce8ede271bc77905c4949ec
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.1
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-04 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.1
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.1
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