bootstripe 0.2.17 → 0.2.18

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.
@@ -0,0 +1,5 @@
1
+ class NilClass
2
+ def to_bool
3
+ return false
4
+ end
5
+ end
@@ -8,8 +8,8 @@ class String
8
8
  end
9
9
 
10
10
  def to_bool
11
- return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
12
- return false if self == false || self.empty? || self =~ (/(false|f|no|n|0)$/i)
11
+ return true if self == true || self =~ (/(true|t|yes|y|1|on)$/i)
12
+ return false if self == false || self.empty? || self =~ (/(false|f|no|n|0|off)$/i)
13
13
  raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstripe
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
  end
data/lib/bootstripe.rb CHANGED
@@ -7,6 +7,7 @@ require 'bootstripe/hash_additions'
7
7
  require 'bootstripe/date_additions'
8
8
  require 'bootstripe/number_additions'
9
9
  require 'bootstripe/string_additions'
10
+ require 'bootstripe/nil_class_additions'
10
11
 
11
12
  # Middleware
12
13
  require 'bootstripe/www_middleware'
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe NilClass do
4
+ it 'should parse nil as a false boolean' do
5
+ nil.to_bool.should be_false
6
+ end
7
+ end
@@ -12,6 +12,7 @@ describe String do
12
12
  "yes".to_bool.should be_true
13
13
  "y".to_bool.should be_true
14
14
  "1".to_bool.should be_true
15
+ "on".to_bool.should be_true
15
16
  end
16
17
 
17
18
  it 'should parse false booleans' do
@@ -22,6 +23,7 @@ describe String do
22
23
  "no".to_bool.should be_false
23
24
  "n".to_bool.should be_false
24
25
  "0".to_bool.should be_false
26
+ "off".to_bool.should be_false
25
27
  end
26
28
 
27
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-04 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -43,6 +43,7 @@ files:
43
43
  - lib/bootstripe/date_additions.rb
44
44
  - lib/bootstripe/enumerable_additions.rb
45
45
  - lib/bootstripe/hash_additions.rb
46
+ - lib/bootstripe/nil_class_additions.rb
46
47
  - lib/bootstripe/number_additions.rb
47
48
  - lib/bootstripe/string_additions.rb
48
49
  - lib/bootstripe/version.rb
@@ -51,6 +52,7 @@ files:
51
52
  - spec/enumberable_additions_spec.rb
52
53
  - spec/frequency_spec.rb
53
54
  - spec/hash_additions_spec.rb
55
+ - spec/nil_class_additions_spec.rb
54
56
  - spec/number_additions_spec.rb
55
57
  - spec/spec_helper.rb
56
58
  - spec/string_additions_spec.rb
@@ -83,6 +85,7 @@ test_files:
83
85
  - spec/enumberable_additions_spec.rb
84
86
  - spec/frequency_spec.rb
85
87
  - spec/hash_additions_spec.rb
88
+ - spec/nil_class_additions_spec.rb
86
89
  - spec/number_additions_spec.rb
87
90
  - spec/spec_helper.rb
88
91
  - spec/string_additions_spec.rb