reaction 1.0.5 → 1.0.6

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: 1e2fe975ebbc9ec53dde2c1e48604cd9eb95d222
4
- data.tar.gz: 12d3cdf171883b1a45ccab23f84c8683224f9bbe
3
+ metadata.gz: 99de6fc7804e30ba92cef84cfdab18be9c361954
4
+ data.tar.gz: abbb453e161b81ca074eaafb63f5e4dabec70a39
5
5
  SHA512:
6
- metadata.gz: 32909e7e97a62df2be9369e6f36b841fab9adc983d08af2887aacbb2d60ea9ddc7a88f8016b376aa3a4d1412ba5a4ebc0fb94353e08c1f1494b89a090dd7c21c
7
- data.tar.gz: c69bc02d57290a4e6bdbc02a1989018f06f87b039937aaaae548211e13cc3a28e9c98462b4940850963b3e1665c43b950d16b9e944a5dd5b2cc123cbeaeb700a
6
+ metadata.gz: bd584eb1154eae39bf5c5d0de24a41f909c535a12107711e083f702e53f7b5f20a70830d3872846d6253b2b740a9b7226ebcfce65d0abd47c7286f9c78801a06
7
+ data.tar.gz: 81cdb79f9a8eaa2fe9e0774973b1899bb202852d20ea4f9e39a4b7bbe9ee7fd80ba956fd6490dbc112d0386dc479b15b883635291994f697750de81e66060302
@@ -15,7 +15,8 @@ module Reaction
15
15
  return false unless validate_attributes
16
16
  _params.each do |name, param|
17
17
  unless param.process
18
- failure(param.error) and return false
18
+ failure(param.error)
19
+ return false
19
20
  end
20
21
  end
21
22
  perform
@@ -23,13 +24,17 @@ module Reaction
23
24
  end
24
25
 
25
26
  def success(result)
26
- @successful = true
27
27
  @result = result
28
+ @successful = true
28
29
  end
29
30
 
30
31
  def failure(error)
31
- @successful = false
32
32
  @error = error
33
+ @successful = false
34
+ end
35
+
36
+ def failed?
37
+ @successful == false
33
38
  end
34
39
 
35
40
  # This is how you retrieve a param. Pass in a mode of :raw in
@@ -56,7 +56,8 @@ CODE
56
56
  unless send(attribute)
57
57
  # This is a server side error - we didn't set a valid attribute
58
58
  # for some reason, and attributes are things the server sets.
59
- failure(AttributeError.new(attribute)) and return false
59
+ failure(AttributeError.new(attribute))
60
+ return false
60
61
  end
61
62
  end
62
63
  end
@@ -23,23 +23,26 @@ module Reaction
23
23
  if type.process(raw_value)
24
24
  validators.each do |validator|
25
25
  unless validator.process(type.result)
26
- failure(validator.error) and return false
26
+ failure(validator.error)
27
+ return false
27
28
  end
28
29
  end
29
30
  else
30
- failure(type.error) and return false
31
+ failure(type.error)
32
+ return false
31
33
  end
32
- success(type.result) and return true
34
+ success(type.result)
35
+ true
33
36
  end
34
37
 
35
38
  def success(result)
36
- @successful = true
37
39
  @result = result
40
+ @successful = true
38
41
  end
39
42
 
40
43
  def failure(error)
41
- @successful = false
42
44
  @error = ParamError.new(name, error)
45
+ @successful = false
43
46
  end
44
47
 
45
48
  def provided?
data/lib/reaction/type.rb CHANGED
@@ -28,8 +28,8 @@ module Reaction
28
28
  end
29
29
 
30
30
  def success(result)
31
- @successful = true
32
31
  @result = result
32
+ @successful = true
33
33
  end
34
34
 
35
35
  def failed?
@@ -37,8 +37,8 @@ module Reaction
37
37
  end
38
38
 
39
39
  def failure(error)
40
- @successful = false
41
40
  @error = error
41
+ @successful = false
42
42
  end
43
43
 
44
44
  def validate_with(validator, options, value)
@@ -21,8 +21,8 @@ module Reaction
21
21
  end
22
22
 
23
23
  def failure(error)
24
- @successful = false
25
24
  @error = error
25
+ @successful = false
26
26
  end
27
27
 
28
28
  def failed?
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.5'
7
+ gem.version = '1.0.6'
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.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Calhoun
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-13 00:00:00.000000000 Z
13
+ date: 2016-05-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: redcarpet