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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 457e465ff3fd83aac8e51d372062e05c86c71a36b7e1d73a768c67faef45804a
4
- data.tar.gz: 973f010dbbb602e615de80fcadc9de9d06e0b0dc88c07d230c996e8ff2e4d8e0
3
+ metadata.gz: 361db45417f5db77cc41e4e6c77bf2689865ade2d842426da780e3b0eb5e0e2e
4
+ data.tar.gz: 86232d87590c5b153e177188f6907d49d9393008296c5e5f84f969d721db813d
5
5
  SHA512:
6
- metadata.gz: 3ae284416ea24ca1ec524a7492c1a5f17aea8a8df0a4a4dac631e4727ec33b3c0ee233c74b9b686342acb18f52ab7c05ea7222b124e6b6c2e71cb8d874078b30
7
- data.tar.gz: c8d0567449ea5660fcd556f71623ffdb9bf7bc2a460b1373b003955235df83f59a7f742907856e5af6479c7cb39d7c74323d20671ede4a3e7fcf9ffca270bdd6
6
+ metadata.gz: 0d2aad7c2f64836276f924db57370a92d7f69022e4ae368beb227f7531a5ed32cad5cfdc054c0c2a996b6dc97a158bc796d23bc710705a48bbda073cee39a923
7
+ data.tar.gz: 69e09d3d348def640b0e0936b537e4fe1b0797f907cd398542c8fbf4c36db279d2c5a4e766e9aa387758171947cfb86068915347b2ecbe4511026c55d92892f8
@@ -1,10 +1,8 @@
1
1
  module Isomorfeus
2
2
  module Props
3
3
  class ValidateHashProxy
4
- DEFAULT_HASH = { required: true, validate: {} }
5
-
6
4
  def initialize
7
- @validation_hash = DEFAULT_HASH
5
+ @validation_hash = { required: true, validate: {} }
8
6
  end
9
7
 
10
8
  def is
@@ -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 value.to_i
30
- when String then value.to_s
31
- when Float then value.to_f
32
- when Array then value.to_a
33
- when Hash then value.to_h
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 value.class == @o[:class]
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 value.class == @o[:class]
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 value.is_a?(@o[:is_a])
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 value.class == TrueClass || value.class == FalseClass
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.matches?(@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 base.validate_function === 'undefined') {
34
- base.validate_function = function(props_object) {
35
- return base.$validate_props(`Opal.Hash.new(props_object)`)
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 base.validate_function;
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 base[function_name] === 'undefined') {
46
- base[function_name] = function(value) {
47
- return base.$validate_prop(prop, value);
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 base[function_name];
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?[prop]
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
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '16.9.12'
2
+ VERSION = '16.9.13'
3
3
  end
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.12
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-24 00:00:00.000000000 Z
11
+ date: 2019-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj