card-mod-virtual 0.11.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/card/virtual.rb +10 -9
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a2fe1a20f384f02c76aa46ee58ace224611ff2647bd5fba753c34d6764715e
|
4
|
+
data.tar.gz: 9491ac3071d94b927ae73e3484c852e97f5a5e9f46d6538c3273e90b838bad06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a4e08a7f1d7cd292b4fa3f623859634458a3c60126733e30e576d42fc62ccc35d251fa48c70cc4d9d58eda1d2933cf0f1a5aaa31e7be3296d858d47204d6859
|
7
|
+
data.tar.gz: 002c9d8e9811b052b3aa85cc387014e78b231bea6a094e8edb639500f877e5ccb2fd692d179f0b30338767119beb9d52a9938f4e04b5230957c5197f5a99a52c
|
data/lib/card/virtual.rb
CHANGED
@@ -4,7 +4,7 @@ class Card
|
|
4
4
|
# Model for the card_virtuals table.
|
5
5
|
# It provides method to get and store content for virtual cards from
|
6
6
|
# the card_virtuals table.
|
7
|
-
class Virtual <
|
7
|
+
class Virtual < Cardio::Record
|
8
8
|
def update new_content
|
9
9
|
update! content: new_content
|
10
10
|
new_content
|
@@ -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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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.
|
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.
|
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.
|
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.
|
4
|
+
version: 0.12.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: 2021-
|
13
|
+
date: 2021-07-05 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.
|
21
|
+
version: 1.102.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.
|
28
|
+
version: 1.102.0
|
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.
|
63
|
+
rubygems_version: 3.2.15
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: virtual
|