reaction 1.0.4 → 1.0.5

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
  SHA1:
3
- metadata.gz: ce9046108073872d8f8e37cb0e2d78781cc253bf
4
- data.tar.gz: 26ff2b61c56b418c30ffd5b0ac952a327f7b97ca
3
+ metadata.gz: 1e2fe975ebbc9ec53dde2c1e48604cd9eb95d222
4
+ data.tar.gz: 12d3cdf171883b1a45ccab23f84c8683224f9bbe
5
5
  SHA512:
6
- metadata.gz: 042c13568ba3424f2baf08cf7f7e8af05c8006b4d47496e1f4fc8b70571b2fa3f16b17b8f9e50c0306ba61bdd49382854a91851f9feb2a161bad3c83c968ee04
7
- data.tar.gz: d0303e340a37ee62426f9276c0ea7bf4b40e2d4d190af0c918ddc915eb6989266a46b2e00d6adb7971cd692e56340bf50fe63e56790c48846c0d2477d49b1693
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
- @attributes ||= []
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
@@ -25,5 +25,9 @@ module Reaction
25
25
  @error = error
26
26
  end
27
27
 
28
+ def failed?
29
+ @successful == false
30
+ end
31
+
28
32
  end
29
33
  end
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.4'
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.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Calhoun