abongo 1.0.0 → 1.0.1

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.
@@ -14,9 +14,25 @@ class Abongo
14
14
  elsif (Abongo.options[:enable_selection] && !params[test_name].nil?)
15
15
  choice = alternatives[params[test_name].to_i]
16
16
  elsif (alternatives.nil?)
17
- choice = Abongo.flip(test_name, options)
17
+ begin
18
+ choice = Abongo.flip(test_name, options)
19
+ rescue
20
+ if Abongo.options[:failsafe]
21
+ choice = true
22
+ else
23
+ raise
24
+ end
25
+ end
18
26
  else
19
- choice = Abongo.test(test_name, alternatives, options)
27
+ begin
28
+ choice = Abongo.test(test_name, alternatives, options)
29
+ rescue
30
+ if Abongo.options[:failsafe]
31
+ choice = Abongo.parse_alternatives(alternatives).first
32
+ else
33
+ raise
34
+ end
35
+ end
20
36
  end
21
37
 
22
38
  if block_given?
@@ -1,4 +1,4 @@
1
1
  class Abongo
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  MAJOR_VERSION = '1'
4
4
  end
@@ -12,9 +12,25 @@ class Abongo
12
12
  elsif (Abongo.options[:enable_selection] && !params[test_name].nil?)
13
13
  choice = alternatives[params[test_name].to_i]
14
14
  elsif (alternatives.nil?)
15
- choice = Abongo.flip(test_name, options)
15
+ begin
16
+ choice = Abongo.flip(test_name, options)
17
+ rescue
18
+ if Abongo.options[:failsafe]
19
+ choice = true
20
+ else
21
+ raise
22
+ end
23
+ end
16
24
  else
17
- choice = Abongo.test(test_name, alternatives, options)
25
+ begin
26
+ choice = Abongo.test(test_name, alternatives, options)
27
+ rescue
28
+ if Abongo.options[:failsafe]
29
+ choice = Abongo.parse_alternatives(alternatives).first
30
+ else
31
+ raise
32
+ end
33
+ end
18
34
  end
19
35
 
20
36
  if block
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Fairley
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-25 00:00:00 -08:00
17
+ date: 2011-02-28 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency