card-mod-virtual 0.11.3 → 0.11.7

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 +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60270b547c050c172152f0a2db3d49861f54da82d2a31fac826d442a7e389933
4
- data.tar.gz: 92d54d6b2426fbd03b6af04fd30e28ca0e1aae0426baace7b2d8135370db588e
3
+ metadata.gz: c39ce623f2e51e27f5b280704bf02fe9dbb930ea12afc97f6e87ef6c8b89d1d5
4
+ data.tar.gz: f0fc35bb8c2a4d60c473e396567a08a1561e7d931323970394bae59851076853
5
5
  SHA512:
6
- metadata.gz: 58df3cf5ecadca1ced315e0f7fced5a7f242fb901790c85832ab3a02488f07095f93ab3ecc9b5473e48a746e9ac2baefdab0838b0d194aa212dbabcd6472f939
7
- data.tar.gz: 292287f835554147518a8e84f7efcd82df567f9d3d2973f7750f3be4c657b6a90cdbadd0a31721b1634c3eefffe3788a5e9023f861de97f60dcdf044cf973868
6
+ metadata.gz: '0481ca235854074a9c5fda6a296e971ba0aa88df517e7f2b8be7f4b95137e9b1f9280265389f5e6190c4df7631e3fcbadef2ef0f49dae636c599c324ffb30c1a'
7
+ data.tar.gz: 2aa5a2001bace37626f97ade21b7a4cfa49829e8518fb382a0fd59f745b4ff8567e82abefe5b26876bb49b7ba6eeb516c302b33b422fccadd9f67540a3a23b29
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.3
4
+ version: 0.11.7
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-04-01 00:00:00.000000000 Z
13
+ date: 2021-08-01 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.3
21
+ version: 1.101.7
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.3
28
+ version: 1.101.7
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
- rubygems_version: 3.1.4
63
+ rubygems_version: 3.1.6
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: virtual