key-vortex 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -12
- data/lib/key_vortex/field.rb +4 -0
- data/lib/key_vortex/limitation.rb +25 -4
- data/lib/key_vortex/record.rb +12 -0
- data/lib/key_vortex/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fcc61bdf13488c6d20e7f6aa4e889852a37ef52b4ea341d8f4c62c40afe8426
|
4
|
+
data.tar.gz: e219c616d9a53e0874221e3ff748a2b4c608dd7c03c86fa765f3f13ffbfabc09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df02551af7fd966c79f390ea2e15c5984540774eaf23c8770593ac3f750277eebec72975d10d6c8fa80216cd3096689caaf565308b3629d6eb1e7383ee0c6279
|
7
|
+
data.tar.gz: 294e8d44baddfb66d5c909754cf1f48aac50af12fedde35dc9d81e73e8ea68efb1a7a623283229eae745ff19cea284f19b5c08925147089b9b99ff87afe97235
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
key-vortex (0.2.
|
4
|
+
key-vortex (0.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -33,8 +33,11 @@ GEM
|
|
33
33
|
guard (~> 2.0)
|
34
34
|
rubocop (< 2.0)
|
35
35
|
json (2.6.3)
|
36
|
-
key_vortex-contract (0.2.
|
36
|
+
key_vortex-contract (0.2.1.2)
|
37
|
+
rantly (~> 2.0.0)
|
38
|
+
rspec (~> 3.0)
|
37
39
|
kwalify (0.7.2)
|
40
|
+
language_server-protocol (3.17.0.3)
|
38
41
|
listen (3.8.0)
|
39
42
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
40
43
|
rb-inotify (~> 0.9, >= 0.9.10)
|
@@ -44,14 +47,17 @@ GEM
|
|
44
47
|
notiffany (0.1.3)
|
45
48
|
nenv (~> 0.1)
|
46
49
|
shellany (~> 0.0)
|
47
|
-
parallel (1.
|
48
|
-
parser (3.2.2.
|
50
|
+
parallel (1.23.0)
|
51
|
+
parser (3.2.2.3)
|
49
52
|
ast (~> 2.4.1)
|
53
|
+
racc
|
50
54
|
pry (0.14.2)
|
51
55
|
coderay (~> 1.1)
|
52
56
|
method_source (~> 1.0)
|
57
|
+
racc (1.7.1)
|
53
58
|
rainbow (3.1.1)
|
54
59
|
rake (13.0.6)
|
60
|
+
rantly (2.0.0)
|
55
61
|
rb-fsevent (0.11.2)
|
56
62
|
rb-inotify (0.10.1)
|
57
63
|
ffi (~> 1.0)
|
@@ -59,32 +65,33 @@ GEM
|
|
59
65
|
kwalify (~> 0.7.0)
|
60
66
|
parser (~> 3.2.0)
|
61
67
|
rainbow (>= 2.0, < 4.0)
|
62
|
-
regexp_parser (2.
|
68
|
+
regexp_parser (2.8.1)
|
63
69
|
rexml (3.2.5)
|
64
70
|
rspec (3.12.0)
|
65
71
|
rspec-core (~> 3.12.0)
|
66
72
|
rspec-expectations (~> 3.12.0)
|
67
73
|
rspec-mocks (~> 3.12.0)
|
68
|
-
rspec-core (3.12.
|
74
|
+
rspec-core (3.12.2)
|
69
75
|
rspec-support (~> 3.12.0)
|
70
|
-
rspec-expectations (3.12.
|
76
|
+
rspec-expectations (3.12.3)
|
71
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
78
|
rspec-support (~> 3.12.0)
|
73
|
-
rspec-mocks (3.12.
|
79
|
+
rspec-mocks (3.12.6)
|
74
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
81
|
rspec-support (~> 3.12.0)
|
76
|
-
rspec-support (3.12.
|
77
|
-
rubocop (1.
|
82
|
+
rspec-support (3.12.1)
|
83
|
+
rubocop (1.54.1)
|
78
84
|
json (~> 2.3)
|
85
|
+
language_server-protocol (>= 3.17.0)
|
79
86
|
parallel (~> 1.10)
|
80
|
-
parser (>= 3.2.
|
87
|
+
parser (>= 3.2.2.3)
|
81
88
|
rainbow (>= 2.2.2, < 4.0)
|
82
89
|
regexp_parser (>= 1.8, < 3.0)
|
83
90
|
rexml (>= 3.2.5, < 4.0)
|
84
91
|
rubocop-ast (>= 1.28.0, < 2.0)
|
85
92
|
ruby-progressbar (~> 1.7)
|
86
93
|
unicode-display_width (>= 2.4.0, < 3.0)
|
87
|
-
rubocop-ast (1.
|
94
|
+
rubocop-ast (1.29.0)
|
88
95
|
parser (>= 3.2.1.0)
|
89
96
|
ruby-progressbar (1.13.0)
|
90
97
|
shellany (0.0.1)
|
data/lib/key_vortex/field.rb
CHANGED
@@ -27,9 +27,9 @@ class KeyVortex
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def encompasses_constraint?(constraint)
|
30
|
-
|
30
|
+
applicable_constraints(constraint).any? do |con|
|
31
31
|
con.within?(constraint)
|
32
|
-
end
|
32
|
+
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def within?(limitation)
|
@@ -39,9 +39,9 @@ class KeyVortex
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def within_constraint?(constraint)
|
42
|
-
|
42
|
+
applicable_constraints(constraint).any? do |con|
|
43
43
|
con.within?(constraint)
|
44
|
-
end
|
44
|
+
end
|
45
45
|
end
|
46
46
|
|
47
47
|
def applicable_constraints(constraint)
|
@@ -54,6 +54,27 @@ class KeyVortex
|
|
54
54
|
value.is_a?(type) && @constraints.all? { |constraint| constraint.accepts?(value) }
|
55
55
|
end
|
56
56
|
|
57
|
+
JSON_ADDITIONS = {
|
58
|
+
BigDecimal: "json/add/bigdecimal",
|
59
|
+
Complex: "json/add/complex",
|
60
|
+
Date: "json/add/date",
|
61
|
+
DateTime: "json/add/date_time",
|
62
|
+
Exception: "json/add/exception",
|
63
|
+
OpenStruct: "json/add/ostruct",
|
64
|
+
Range: "json/add/range",
|
65
|
+
Rational: "json/add/rational",
|
66
|
+
Regexp: "json/add/regexp",
|
67
|
+
Set: "json/add/set",
|
68
|
+
Struct: "json/add/struct",
|
69
|
+
Symbol: "json/add/symbol",
|
70
|
+
Time: "json/add/time"
|
71
|
+
}.freeze
|
72
|
+
|
73
|
+
def enable_json_additions
|
74
|
+
path = JSON_ADDITIONS[@type.class.name]
|
75
|
+
require path if path
|
76
|
+
end
|
77
|
+
|
57
78
|
def to_s
|
58
79
|
"Limitation: #{@type}\n\t#{@constraints.join('\n\t')}"
|
59
80
|
end
|
data/lib/key_vortex/record.rb
CHANGED
@@ -25,6 +25,7 @@ class KeyVortex
|
|
25
25
|
|
26
26
|
def self.register_field(field)
|
27
27
|
field_hash[field.name] = field
|
28
|
+
field.enable_json_additions
|
28
29
|
define_getter(field)
|
29
30
|
define_setter(field)
|
30
31
|
end
|
@@ -63,5 +64,16 @@ class KeyVortex
|
|
63
64
|
def ==(other)
|
64
65
|
self.class == other.class && values == other.values
|
65
66
|
end
|
67
|
+
|
68
|
+
def to_json(*args)
|
69
|
+
{
|
70
|
+
JSON.create_id => self.class.name,
|
71
|
+
"values" => @values
|
72
|
+
}.to_json(*args)
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.json_create(object)
|
76
|
+
new(object["values"])
|
77
|
+
end
|
66
78
|
end
|
67
79
|
end
|
data/lib/key_vortex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: key-vortex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lambda Null
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Defines abstractions that can be built on top of for key/value storage
|
14
14
|
on different technologies (file, s3, sql, redis, etc.)
|