card-mod-virtual 0.11.4 → 0.11.5

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 +9 -8
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcb67fd21bcfd4831511564776dde8301be866c0a618b72531fdae742767caea
4
- data.tar.gz: 3866a62b75c6804d69544c2778b5b0f5085eb211f088de3c35a6611db14fd64b
3
+ metadata.gz: 337483bc9ae560deddde844d6c69c454b8bd5066699fd3c89a2eb10fe5373995
4
+ data.tar.gz: d3fcad3b627d976b987c3dc75ebf407f16fd5c648c2052ce066bfe11cf43a163
5
5
  SHA512:
6
- metadata.gz: 2894f8e78145934ec5b18173a548691fe93d5b67dff6fed4e4a2e6aac512ce5103acdf6fbb5fe45a20017b92bdf7ce214f43426f4468e4cb3381e8a2885ff15e
7
- data.tar.gz: bf4db6338ec2e0a7859a84ac4af919259b4e218046dce4b027a358806d34c23952f99c053c617989d0f331b59e92e760ec099b3e3e60131b78d0f1c179c67fa0
6
+ metadata.gz: 7023e26edcf7fb111afe03751290ec55f794ce8bc9fd1820b7152c431a7325550f5f2866fbb462cf153b41bb349f4da34bbcdedd8ca7093cb15cb3bf86ec735d
7
+ data.tar.gz: '096bdd22e3fa426760b6b21adc63e21ce8420bb14e0292c461b7692ce39c2f0c69c7c6ba8006d95f2c2124ace6cfe5bb03ce25656a35001b4640e3c73ffbf363'
data/lib/card/virtual.rb CHANGED
@@ -14,11 +14,10 @@ class Card
14
14
  def create card, virtual_content=nil
15
15
  validate_card card
16
16
  virtual_content ||= block_given? ? yield : card.generate_virtual_content
17
- virtual = new left_id: left_id(card), right_id: right_id(card),
18
- left_key: card.name.left_key,
19
- content: virtual_content
20
- virtual.save!
21
- virtual
17
+ create! left_id: left_id(card),
18
+ right_id: right_id(card),
19
+ left_key: card.name.left_key,
20
+ content: virtual_content
22
21
  end
23
22
 
24
23
  def create_or_update card, virtual_content
@@ -40,6 +39,7 @@ class Card
40
39
  def refresh card
41
40
  virtual = find_by_card(card)
42
41
  return create(card) unless virtual
42
+
43
43
  virtual.update card.generate_virtual_content
44
44
  end
45
45
 
@@ -64,7 +64,7 @@ class Card
64
64
  end
65
65
 
66
66
  def left_id card
67
- if card.junction?
67
+ if card.compound?
68
68
  card.left_id&.positive? ? card.left_id : card.left&.id
69
69
  else
70
70
  card.id
@@ -72,7 +72,7 @@ class Card
72
72
  end
73
73
 
74
74
  def right_id card
75
- if card.junction?
75
+ if card.compound?
76
76
  card.right_id&.positive? ? card.right_id : card.right&.id
77
77
  else
78
78
  -2
@@ -81,13 +81,14 @@ class Card
81
81
 
82
82
  def validate_card card
83
83
  reason ||=
84
- if card.junction?
84
+ if card.compound?
85
85
  "needs left_id" unless left_id(card)
86
86
  "needs right_id" unless right_id(card)
87
87
  elsif !card.id
88
88
  "needs id"
89
89
  end
90
90
  return unless reason
91
+
91
92
  raise Card::Error, card.name, "count not cacheable: card #{card.name} #{reason}"
92
93
  end
93
94
  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.11.4
4
+ version: 0.11.5
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: 2021-05-05 00:00:00.000000000 Z
13
+ date: 2021-05-10 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.101.4
21
+ version: 1.101.5
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.101.4
28
+ version: 1.101.5
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org