isomorfeus-react 16.12.15 → 16.12.16
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c51e1ae7cb26a3240215e958cf0f605f65cc048f3f0280f06be1af1019b0c667
|
4
|
+
data.tar.gz: 7820879dd2c4131dea2a133b0d80ec8509ef4ed80fec87bb1315b57e191cbf1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a81c98464f696bef417dbc0cceb1c8acd851ff27338d6270527b0b7ff87759fa78cd04f86764b0361cec6b4e3a4f36e85da5e03fc52dbb38f13c851c0bfa78c
|
7
|
+
data.tar.gz: 147a51fb0e634a5ed0089c164445ea8981f7cd6bd5bfabb7f5223f1ce6268ade29486c188b6c1c0a2a9567448ddc8677fc31991ecbddf2517c8a5b829a160080
|
@@ -11,6 +11,7 @@ module Isomorfeus
|
|
11
11
|
def validate!
|
12
12
|
ensured = ensure!
|
13
13
|
unless ensured
|
14
|
+
set_default_value
|
14
15
|
cast!
|
15
16
|
type!
|
16
17
|
end
|
@@ -18,10 +19,20 @@ module Isomorfeus
|
|
18
19
|
true
|
19
20
|
end
|
20
21
|
|
22
|
+
def validated_value
|
23
|
+
validate!
|
24
|
+
@v
|
25
|
+
end
|
26
|
+
|
21
27
|
private
|
22
28
|
|
23
29
|
# basic tests
|
24
30
|
|
31
|
+
def set_default_value
|
32
|
+
return unless @v.nil?
|
33
|
+
@v = @o[:default] if @o.key?(:default)
|
34
|
+
end
|
35
|
+
|
25
36
|
def cast!
|
26
37
|
if @o.key?(:cast)
|
27
38
|
begin
|
@@ -73,6 +84,7 @@ module Isomorfeus
|
|
73
84
|
send('c_' + m, l)
|
74
85
|
end
|
75
86
|
end
|
87
|
+
@o[:validate_block].call(@v) if @o.key?(:validate_block)
|
76
88
|
end
|
77
89
|
|
78
90
|
# specific validations
|
@@ -93,5 +93,28 @@ module LucidPropDeclaration
|
|
93
93
|
end
|
94
94
|
result
|
95
95
|
end
|
96
|
+
|
97
|
+
def validated_prop(prop, value)
|
98
|
+
nil unless declared_props.key?(prop)
|
99
|
+
validator = Isomorfeus::Props::Validator.new(self, prop, value, declared_props[prop])
|
100
|
+
validator.validated_value
|
101
|
+
end
|
102
|
+
|
103
|
+
def validated_props(props)
|
104
|
+
props = {} unless props
|
105
|
+
|
106
|
+
declared_props.each_key do |prop|
|
107
|
+
if declared_props[prop].key?(:required) && declared_props[prop][:required] && !props.key?(prop)
|
108
|
+
Isomorfeus.raise_error(message: "Required prop #{prop} not given!")
|
109
|
+
end
|
110
|
+
props[prop] = nil unless props.key?(prop) # let validator handle value
|
111
|
+
end
|
112
|
+
|
113
|
+
result = {}
|
114
|
+
props.each do |p, v|
|
115
|
+
result[p] = validated_prop(p, v)
|
116
|
+
end
|
117
|
+
result
|
118
|
+
end
|
96
119
|
end
|
97
120
|
end
|
@@ -58,9 +58,21 @@ module React
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def to_h
|
62
|
+
`Opal.Hash.$new(#@native)`
|
63
|
+
end
|
64
|
+
|
65
|
+
def to_json
|
66
|
+
JSON.dump(to_transport)
|
67
|
+
end
|
68
|
+
|
61
69
|
def to_n
|
62
70
|
@native.JS[:props]
|
63
71
|
end
|
72
|
+
|
73
|
+
def to_transport
|
74
|
+
{}.merge(to_h)
|
75
|
+
end
|
64
76
|
end
|
65
77
|
end
|
66
78
|
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.12.
|
4
|
+
version: 16.12.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -277,7 +277,7 @@ metadata:
|
|
277
277
|
github_repo: ssh://github.com/isomorfeus/gems
|
278
278
|
post_install_message: |2+
|
279
279
|
|
280
|
-
isomorfeus-react 16.12.
|
280
|
+
isomorfeus-react 16.12.16:
|
281
281
|
Breaking change:
|
282
282
|
The event_handler DSL is gone. Instead use normal methods and method_ref, see:
|
283
283
|
https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/events.md
|