isomorfeus-react 16.9.12 → 16.9.13
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/lib/isomorfeus/props/validate_hash_proxy.rb +1 -3
- data/lib/isomorfeus/props/validator.rb +10 -10
- data/lib/lucid_prop_declaration/mixin.rb +11 -9
- data/lib/react/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: 361db45417f5db77cc41e4e6c77bf2689865ade2d842426da780e3b0eb5e0e2e
|
4
|
+
data.tar.gz: 86232d87590c5b153e177188f6907d49d9393008296c5e5f84f969d721db813d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d2aad7c2f64836276f924db57370a92d7f69022e4ae368beb227f7531a5ed32cad5cfdc054c0c2a996b6dc97a158bc796d23bc710705a48bbda073cee39a923
|
7
|
+
data.tar.gz: 69e09d3d348def640b0e0936b537e4fe1b0797f907cd398542c8fbf4c36db279d2c5a4e766e9aa387758171947cfb86068915347b2ecbe4511026c55d92892f8
|
@@ -26,15 +26,15 @@ module Isomorfeus
|
|
26
26
|
if @o.key?(:cast)
|
27
27
|
begin
|
28
28
|
@v = case @o[:class]
|
29
|
-
when Integer then
|
30
|
-
when String then
|
31
|
-
when Float then
|
32
|
-
when Array then
|
33
|
-
when Hash then
|
29
|
+
when Integer then @v.to_i
|
30
|
+
when String then @v.to_s
|
31
|
+
when Float then @v.to_f
|
32
|
+
when Array then @v.to_a
|
33
|
+
when Hash then @v.to_h
|
34
34
|
end
|
35
35
|
@v = !!@v if @o[:type] == :boolean
|
36
36
|
rescue
|
37
|
-
raise "#{@c}: #{@p} cast failed" unless
|
37
|
+
raise "#{@c}: #{@p} cast failed" unless @v.class == @o[:class]
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -53,13 +53,13 @@ module Isomorfeus
|
|
53
53
|
|
54
54
|
def type!
|
55
55
|
if @o.key?(:class)
|
56
|
-
raise "#{@c}: #{@p} class not #{@o[:class]}" unless
|
56
|
+
raise "#{@c}: #{@p} class not #{@o[:class]}" unless @v.class == @o[:class]
|
57
57
|
elsif @o.key?(:is_a)
|
58
|
-
raise "#{@c}: #{@p} is not a #{@o[:is_a]}" unless
|
58
|
+
raise "#{@c}: #{@p} is not a #{@o[:is_a]}" unless @v.is_a?(@o[:is_a])
|
59
59
|
elsif @o.key?(:type)
|
60
60
|
case @o[:type]
|
61
61
|
when :boolean
|
62
|
-
raise "#{@c}: #{@p} is not a boolean" unless
|
62
|
+
raise "#{@c}: #{@p} is not a boolean" unless @v.class == TrueClass || @v.class == FalseClass
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -92,7 +92,7 @@ module Isomorfeus
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def c_matches(v)
|
95
|
-
raise "#{@c}: #{@p} does not match #{v}" unless v.
|
95
|
+
raise "#{@c}: #{@p} does not match #{v}" unless v.match?(@v)
|
96
96
|
end
|
97
97
|
|
98
98
|
def c_max(v)
|
@@ -30,24 +30,26 @@ module LucidPropDeclaration
|
|
30
30
|
|
31
31
|
def validate_function
|
32
32
|
%x{
|
33
|
-
if (typeof
|
34
|
-
|
35
|
-
|
33
|
+
if (typeof self.validate_function === 'undefined') {
|
34
|
+
self.validate_function = function(props_object) {
|
35
|
+
try { self.$validate_props(Opal.Hash.$new(props_object)) }
|
36
|
+
catch (e) { return e.message; }
|
36
37
|
}
|
37
38
|
}
|
38
|
-
return
|
39
|
+
return self.validate_function;
|
39
40
|
}
|
40
41
|
end
|
41
42
|
|
42
43
|
def validate_prop_function(prop)
|
43
44
|
function_name = "validate_#{prop}_function"
|
44
45
|
%x{
|
45
|
-
if (typeof
|
46
|
-
|
47
|
-
|
46
|
+
if (typeof self[function_name] === 'undefined') {
|
47
|
+
self[function_name] = function(value) {
|
48
|
+
try { self.$validate_prop(prop, value); }
|
49
|
+
catch (e) { return e.message; }
|
48
50
|
}
|
49
51
|
}
|
50
|
-
return
|
52
|
+
return self[function_name];
|
51
53
|
}
|
52
54
|
end
|
53
55
|
else
|
@@ -74,7 +76,7 @@ module LucidPropDeclaration
|
|
74
76
|
|
75
77
|
def validate_props(props)
|
76
78
|
declared_props.each_key do |prop|
|
77
|
-
if declared_props[prop].key?(:required) && declared_props[prop][:required] && !props.key?
|
79
|
+
if declared_props[prop].key?(:required) && declared_props[prop][:required] && !props.key?(prop)
|
78
80
|
raise "Required prop #{prop} not given!"
|
79
81
|
end
|
80
82
|
end
|
data/lib/react/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.9.
|
4
|
+
version: 16.9.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|