reaction 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reaction/has_attributes.rb +18 -1
- data/lib/reaction/type.rb +11 -0
- data/lib/reaction/validator.rb +4 -0
- data/reaction.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e2fe975ebbc9ec53dde2c1e48604cd9eb95d222
|
4
|
+
data.tar.gz: 12d3cdf171883b1a45ccab23f84c8683224f9bbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32909e7e97a62df2be9369e6f36b841fab9adc983d08af2887aacbb2d60ea9ddc7a88f8016b376aa3a4d1412ba5a4ebc0fb94353e08c1f1494b89a090dd7c21c
|
7
|
+
data.tar.gz: c69bc02d57290a4e6bdbc02a1989018f06f87b039937aaaae548211e13cc3a28e9c98462b4940850963b3e1665c43b950d16b9e944a5dd5b2cc123cbeaeb700a
|
@@ -12,7 +12,18 @@ module Reaction
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def attributes
|
15
|
-
|
15
|
+
if self == Reaction::Action
|
16
|
+
@attributes ||= []
|
17
|
+
else
|
18
|
+
@attributes ||= begin
|
19
|
+
attrs = superclass.attributes
|
20
|
+
if attrs.respond_to?(:deep_dup)
|
21
|
+
attrs.deep_dup
|
22
|
+
else
|
23
|
+
attrs.dup
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
16
27
|
end
|
17
28
|
|
18
29
|
def getter_code(name)
|
@@ -50,5 +61,11 @@ CODE
|
|
50
61
|
end
|
51
62
|
end
|
52
63
|
|
64
|
+
private
|
65
|
+
|
66
|
+
def deep_dup(hash = {})
|
67
|
+
|
68
|
+
end
|
69
|
+
|
53
70
|
end
|
54
71
|
end
|
data/lib/reaction/type.rb
CHANGED
@@ -41,6 +41,16 @@ module Reaction
|
|
41
41
|
@error = error
|
42
42
|
end
|
43
43
|
|
44
|
+
def validate_with(validator, options, value)
|
45
|
+
v = ValidatorBuilder.new(validator, options).build(action)
|
46
|
+
v.process(value)
|
47
|
+
if v.failed?
|
48
|
+
failure(v.error)
|
49
|
+
return false
|
50
|
+
end
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
44
54
|
# This isn't perfect but works well enough.
|
45
55
|
def self.to_type_symbol
|
46
56
|
ret = self.to_s
|
@@ -50,5 +60,6 @@ module Reaction
|
|
50
60
|
ret.gsub!(/_type$/, '')
|
51
61
|
ret.to_sym
|
52
62
|
end
|
63
|
+
|
53
64
|
end
|
54
65
|
end
|
data/lib/reaction/validator.rb
CHANGED
data/reaction.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'reaction'
|
7
|
-
gem.version = '1.0.
|
7
|
+
gem.version = '1.0.5'
|
8
8
|
gem.authors = ["Jon Calhoun", "Jon Calhoun", "Ryan Jackson"]
|
9
9
|
gem.email = ["joncalhoun@gmail.com", "jon@paidlabs.com", "ryan@paidlabs.com"]
|
10
10
|
gem.description = 'Reaction makes it easy to build reusable controller actions along with reusable validators and param type converters.'
|