wannabe_bool 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86d39d1ce9b9db3cad81264483b7d0cedd5149cd
4
- data.tar.gz: b7816a5392945862c9e2c40adf8cf9a54831f345
3
+ metadata.gz: 7f34ba0e39b595bd2371d18a7e5f22bd2610bd0a
4
+ data.tar.gz: 469ed8e3c641acd26b64dacfc608b25b7b9b3e26
5
5
  SHA512:
6
- metadata.gz: 1e6bbfb88c6fe95f364ab6637b64bc09c56ff33a0a93e99db0415c12d77c2325c7a78c93acf628899f954e17b1bd3c7c508bca6960a016a0498bf8fd874e74ab
7
- data.tar.gz: ec10d991c5f04f89c1e3687833bf774682c7bc12a1c13cd07b78785167c2b90bf55f6921e3e73e7038bfe4e842f16b1a1b344734b6eb7409cf1002c38a67f5cd
6
+ metadata.gz: e5172488e8cf1da43e71078745f7921b8ac31f62b99289bec91677b69e46582f66f5d22808726e1c6dc99dadcd9949f13618475402658f051622812bfc8db079
7
+ data.tar.gz: 6b437e15008f5459fba65fa469752bd2e2a646211db0a7c85ef1c7fe3f6cd43ee500b6a5ea556c8b617b1ff1f8d49defa1b6988c00bfc47801f042ba14555218
@@ -1,5 +1,6 @@
1
1
  | Version | Changes |
2
2
  | ------- | ------- |
3
+ | 0.4.0 | `to_b` in `Numeric` class, not only in `Integer` class. |
3
4
  | 0.3.0 | Fix integer to boolean conversion. [Issue #2](https://github.com/prodis/wannabe_bool/issues/2) |
4
5
  | 0.2.0 | Minimal required Ruby version is 2.0.0 from now. |
5
6
  | 0.1.1 | Remove post install message. |
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Wannabe Bool
2
2
 
3
- If **string**, **integer**, **symbol** and **nil** values wanna be a **boolean** value, they can with the new `to_b` method.
3
+ If **string**, **numeric**, **symbol** and **nil** values wanna be a **boolean** value, they can with the new `to_b` method.
4
4
  Moreover, you can use `WannabeBool::Attributes` module to create predicate methods in your classes.
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/wannabe_bool.svg)](http://badge.fury.io/rb/wannabe_bool)
@@ -8,6 +8,7 @@ Moreover, you can use `WannabeBool::Attributes` module to create predicate metho
8
8
  [![Coverage Status](https://coveralls.io/repos/prodis/wannabe_bool/badge.svg?branch=master&service=github)](https://coveralls.io/github/prodis/wannabe_bool?branch=master)
9
9
  [![Code Climate](https://codeclimate.com/github/prodis/wannabe_bool/badges/gpa.svg)](https://codeclimate.com/github/prodis/wannabe_bool)
10
10
  [![Dependency Status](https://gemnasium.com/prodis/wannabe_bool.svg)](https://gemnasium.com/prodis/wannabe_bool)
11
+ [![GitHub license](https://img.shields.io/apm/l/vim-mode.svg)](LICENSE)
11
12
 
12
13
 
13
14
  ## Installing
@@ -24,18 +25,19 @@ $ gem install wannabe_bool
24
25
 
25
26
  ## Using
26
27
 
27
- `to_b` method is available on `String`, `Symbol`, `Integer`, `TrueClass`, `FalseClass` and `NilClass`.
28
+ `to_b` method is available on `String`, `Symbol`, `Numeric`, `TrueClass`, `FalseClass` and `NilClass`.
28
29
 
29
30
  ```ruby
30
31
  require 'wannabe_bool'
31
32
  ```
32
33
 
33
34
  #### String
35
+ Returns `true` if string is one of **t**, **true**, **on**, **y**, **yes** or **1** values. Returns `false` otherwise.
36
+
37
+ Ignores trailing spaces and letter cases.
38
+
34
39
  ```ruby
35
40
  '1'.to_b # => true
36
- '2'.to_b # => true
37
- '-1'.to_b # => true
38
- '-2'.to_b # => true
39
41
  't'.to_b # => true
40
42
  'T'.to_b # => true
41
43
  'true'.to_b # => true
@@ -47,9 +49,6 @@ require 'wannabe_bool'
47
49
  'YES'.to_b # => true
48
50
 
49
51
  ' 1 '.to_b # => true
50
- ' 2 '.to_b # => true
51
- ' -1 '.to_b # => true
52
- ' -2 '.to_b # => true
53
52
  ' t '.to_b # => true
54
53
  ' T '.to_b # => true
55
54
  ' true '.to_b # => true
@@ -64,6 +63,9 @@ require 'wannabe_bool'
64
63
 
65
64
  ''.to_b # => false
66
65
  '0'.to_b # => false
66
+ '2'.to_b # => false
67
+ '-1'.to_b # => false
68
+ '-2'.to_b # => false
67
69
  'f'.to_b # => false
68
70
  'F'.to_b # => false
69
71
  'false'.to_b # => false
@@ -80,6 +82,8 @@ require 'wannabe_bool'
80
82
  ```
81
83
 
82
84
  #### Symbol
85
+ Same as `symbol.to_s.to_b`.
86
+
83
87
  ```ruby
84
88
  :'1'.to_b # => true
85
89
  :t.to_b # => true
@@ -108,7 +112,10 @@ require 'wannabe_bool'
108
112
  :wherever.to_b # => false
109
113
  ```
110
114
 
111
- #### Integer
115
+ #### Numeric
116
+ Returns `false` if number is zero. Returns `true` otherwise.
117
+
118
+ ##### Integer
112
119
  ```ruby
113
120
  0.to_b # => false
114
121
  1.to_b # => true
@@ -117,17 +124,43 @@ require 'wannabe_bool'
117
124
  -2.to_b # => true
118
125
  ```
119
126
 
127
+ ##### Float
128
+ ```ruby
129
+ 0.0.to_b # => false
130
+ 0.1.to_b # => true
131
+ 1.0.to_b # => true
132
+ -0.1.to_b # => true
133
+ -1.0.to_b # => true
134
+ ```
135
+
136
+ ##### BigDecimal
137
+ ```ruby
138
+ require 'bigdecimal'
139
+
140
+ BigDecimal('0.0').to_b # => false
141
+ BigDecimal('0.1').to_b # => true
142
+ BigDecimal('1.0').to_b # => true
143
+ BigDecimal('-0.1').to_b # => true
144
+ BigDecimal('-1.0').to_b # => true
145
+ ```
146
+
120
147
  #### TrueClass
148
+ Returns `true`.
149
+
121
150
  ```ruby
122
151
  true.to_b # => true
123
152
  ```
124
153
 
125
154
  #### FalseClass
155
+ Returns `false`.
156
+
126
157
  ```ruby
127
158
  false.to_b # => false
128
159
  ```
129
160
 
130
161
  #### NilClass
162
+ Returns `false`.
163
+
131
164
  ```ruby
132
165
  nil.to_b # => false
133
166
  ```
@@ -159,6 +192,10 @@ fake.published = :true
159
192
  fake.published? # => true
160
193
  ```
161
194
 
195
+ ## Changelog
196
+
197
+ [See the changes in each version.](CHANGELOG.md)
198
+
162
199
  ## Author
163
200
  [Fernando Hamasaki de Amorim (prodis)](http://prodis.blog.br)
164
201
 
@@ -1,5 +1,8 @@
1
+ module WannabeBool; end
2
+
1
3
  require 'wannabe_bool/boolean'
2
- require 'wannabe_bool/integer'
3
4
  require 'wannabe_bool/nil'
4
- require 'wannabe_bool/object'
5
+ require 'wannabe_bool/numeric'
6
+ require 'wannabe_bool/string'
7
+ require 'wannabe_bool/symbol'
5
8
  require 'wannabe_bool/attributes'
@@ -1,19 +1,17 @@
1
- module WannabeBool
2
- module Attributes
3
- def self.included(base)
4
- base.extend(ClassMethods)
5
- end
1
+ module WannabeBool::Attributes
2
+ def self.included(base)
3
+ base.extend(ClassMethods)
4
+ end
6
5
 
7
- module ClassMethods
8
- def attr_wannabe_bool(*attributes)
9
- attributes.each do |attr|
10
- raise ArgumentError, "#{attr} method is not defined." unless method_defined?(attr)
6
+ module ClassMethods
7
+ def attr_wannabe_bool(*attributes)
8
+ attributes.each do |attr|
9
+ raise ArgumentError, "#{attr} method is not defined." unless method_defined?(attr)
11
10
 
12
- next if method_defined?("#{attr}?")
11
+ next if method_defined?("#{attr}?")
13
12
 
14
- define_method("#{attr}?") do
15
- send(attr).to_b
16
- end
13
+ define_method("#{attr}?") do
14
+ send(attr).to_b
17
15
  end
18
16
  end
19
17
  end
@@ -1,8 +1,6 @@
1
- module WannabeBool
2
- module Boolean
3
- def to_b
4
- self
5
- end
1
+ module WannabeBool::Boolean
2
+ def to_b
3
+ self
6
4
  end
7
5
  end
8
6
 
@@ -1,8 +1,6 @@
1
- module WannabeBool
2
- module Nil
3
- def to_b
4
- false
5
- end
1
+ module WannabeBool::Nil
2
+ def to_b
3
+ false
6
4
  end
7
5
  end
8
6
 
@@ -0,0 +1,9 @@
1
+ module WannabeBool::Numeric
2
+ def to_b
3
+ !self.zero?
4
+ end
5
+ end
6
+
7
+ class Numeric
8
+ include WannabeBool::Numeric
9
+ end
@@ -0,0 +1,11 @@
1
+ module WannabeBool::String
2
+ TRUES = %W{t true on y yes 1}.freeze
3
+
4
+ def to_b
5
+ TRUES.include?(self.strip.downcase)
6
+ end
7
+ end
8
+
9
+ class String
10
+ include WannabeBool::String
11
+ end
@@ -0,0 +1,9 @@
1
+ module WannabeBool::Symbol
2
+ def to_b
3
+ self.to_s.to_b
4
+ end
5
+ end
6
+
7
+ class Symbol
8
+ include WannabeBool::Symbol
9
+ end
@@ -1,3 +1,3 @@
1
1
  module WannabeBool
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -3,7 +3,7 @@ describe WannabeBool::Boolean do
3
3
  subject { true }
4
4
 
5
5
  describe '#to_b' do
6
- it { expect(subject.to_b).to eq true }
6
+ it { expect(subject.to_b).to be true }
7
7
  end
8
8
  end
9
9
 
@@ -11,7 +11,7 @@ describe WannabeBool::Boolean do
11
11
  subject { false }
12
12
 
13
13
  describe '#to_b' do
14
- it { expect(subject.to_b).to eq false }
14
+ it { expect(subject.to_b).to be false }
15
15
  end
16
16
  end
17
17
  end
@@ -3,7 +3,7 @@ describe WannabeBool::Nil do
3
3
  subject { nil }
4
4
 
5
5
  describe '#to_b' do
6
- it { expect(subject.to_b).to eq false }
6
+ it { expect(subject.to_b).to be false }
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,68 @@
1
+ require 'bigdecimal'
2
+
3
+ describe WannabeBool::Numeric do
4
+ context Integer do
5
+ describe '#to_b' do
6
+ context 'when value is 0' do
7
+ subject { 0 }
8
+ it { expect(subject.to_b).to be false }
9
+ end
10
+
11
+ context 'positive values' do
12
+ (1..9).each do |value|
13
+ context "when value is #{value}" do
14
+ subject { value }
15
+ it { expect(subject.to_b).to be true }
16
+ end
17
+ end
18
+ end
19
+
20
+ context 'negative values' do
21
+ (-9..-1).each do |value|
22
+ context "when value is #{value}" do
23
+ subject { value }
24
+ it { expect(subject.to_b).to be true }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ context Float do
32
+ describe '#to_b' do
33
+ context 'when value is 0.0' do
34
+ subject { 0.0 }
35
+ it { expect(subject.to_b).to be false }
36
+ end
37
+
38
+ context "when value is positive" do
39
+ subject { Random.rand }
40
+ it { expect(subject.to_b).to be true }
41
+ end
42
+
43
+ context "when value is negative" do
44
+ subject { Random.rand * -1 }
45
+ it { expect(subject.to_b).to be true }
46
+ end
47
+ end
48
+ end
49
+
50
+ context BigDecimal do
51
+ describe '#to_b' do
52
+ context 'when value is 0.0' do
53
+ subject { BigDecimal('0.0') }
54
+ it { expect(subject.to_b).to be false }
55
+ end
56
+
57
+ context "when value is positive" do
58
+ subject { BigDecimal('1.0') }
59
+ it { expect(subject.to_b).to be true }
60
+ end
61
+
62
+ context "when value is negative" do
63
+ subject { BigDecimal('-1.0') }
64
+ it { expect(subject.to_b).to be true }
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,40 @@
1
+ describe WannabeBool::String do
2
+ describe '#to_b' do
3
+ [ '1', '1 ', ' 1', ' 1 ',
4
+ 't', 't ', ' t', ' t ',
5
+ 'T', 'T ', ' T', ' T ',
6
+ 'true', 'true ', ' true', ' true ',
7
+ 'TRUE', 'TRUE ', ' TRUE', ' TRUE ',
8
+ 'on', 'on ', ' on', ' on ',
9
+ 'ON', 'ON ', ' ON ', ' ON ',
10
+ 'y', 'y ', ' y', ' y ',
11
+ 'Y', 'Y ', ' Y', ' Y ',
12
+ 'yes', 'yes ', ' yes', ' yes ',
13
+ 'YES', 'YES ', ' YES', ' YES '
14
+ ].each do |value|
15
+ context "when string is '#{value}'" do
16
+ subject { value }
17
+ it { expect(subject.to_b).to be true }
18
+ end
19
+ end
20
+
21
+ [ '',
22
+ '0',
23
+ '2', '2 ', ' 2', ' 2 ',
24
+ '-1', '-1 ', ' -1', ' -1 ',
25
+ '-2', '-2 ', ' -2', ' -2 ',
26
+ 'f', 'F',
27
+ 'false', 'FALSE',
28
+ 'off', 'OFF',
29
+ 'n', 'N',
30
+ 'no', 'NO',
31
+ 'not', 'NOT',
32
+ 'wherever', 'Prodis'
33
+ ].each do |value|
34
+ context "when string is '#{value}'" do
35
+ subject { value }
36
+ it { expect(subject.to_b).to be false }
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ describe WannabeBool::Symbol do
2
+ describe '#to_b' do
3
+ [ :'1', :'1 ', :' 1 ', :' 1',
4
+ :t, :'t ', :' t', :' t ',
5
+ :T, :'T ', :' T', :' T ',
6
+ :true, :'true ', :' true', :' true ',
7
+ :TRUE, :'TRUE ', :' TRUE', :' TRUE ',
8
+ :on, :'on ', :' on', :' on ',
9
+ :ON, :'ON ', :' ON ', :' ON ',
10
+ :y, :'y ', :' y', :' y ',
11
+ :Y, :'Y ', :' Y', :' Y ',
12
+ :yes, :'yes ', :' yes', :' yes ',
13
+ :YES, :'YES ', :' YES', :' YES '
14
+ ].each do |value|
15
+ context "when symbol is '#{value}'" do
16
+ subject { value }
17
+ it { expect(subject.to_b).to be true }
18
+ end
19
+ end
20
+
21
+ [ :'',
22
+ :'0', :'2', :'-1', :'-2',
23
+ :f, :F,
24
+ :false, :FALSE,
25
+ :off, :OFF,
26
+ :n, :N,
27
+ :no, :NO,
28
+ :not, :NOT,
29
+ :wherever, :Prodis
30
+ ].each do |value|
31
+ context "when symbol is '#{value}'" do
32
+ subject { value }
33
+ it { expect(subject.to_b).to be false }
34
+ end
35
+ end
36
+ end
37
+ end
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = WannabeBool::VERSION
8
8
  spec.author = 'Prodis a.k.a. Fernando Hamasaki de Amorim'
9
9
  spec.email = 'prodis@gmail.com'
10
- spec.summary = 'If string, integer, symbol and nil values wanna be a boolean value, they can with the new #to_b method (and more).'
10
+ spec.summary = 'If string, numeric, symbol and nil values wanna be a boolean value, they can with the new #to_b method (and more).'
11
11
  spec.description = spec.summary
12
12
  spec.homepage = 'https://github.com/prodis/wannabe_bool'
13
13
  spec.license = 'MIT'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wannabe_bool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prodis a.k.a. Fernando Hamasaki de Amorim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: 'If string, integer, symbol and nil values wanna be a boolean value,
55
+ description: 'If string, numeric, symbol and nil values wanna be a boolean value,
56
56
  they can with the new #to_b method (and more).'
57
57
  email: prodis@gmail.com
58
58
  executables: []
@@ -70,16 +70,18 @@ files:
70
70
  - lib/wannabe_bool.rb
71
71
  - lib/wannabe_bool/attributes.rb
72
72
  - lib/wannabe_bool/boolean.rb
73
- - lib/wannabe_bool/integer.rb
74
73
  - lib/wannabe_bool/nil.rb
75
- - lib/wannabe_bool/object.rb
74
+ - lib/wannabe_bool/numeric.rb
75
+ - lib/wannabe_bool/string.rb
76
+ - lib/wannabe_bool/symbol.rb
76
77
  - lib/wannabe_bool/version.rb
77
78
  - spec/spec_helper.rb
78
79
  - spec/wannabe_bool/attributes_spec.rb
79
80
  - spec/wannabe_bool/boolean_spec.rb
80
- - spec/wannabe_bool/integer_spec.rb
81
81
  - spec/wannabe_bool/nil_spec.rb
82
- - spec/wannabe_bool/object_spec.rb
82
+ - spec/wannabe_bool/numeric_spec.rb
83
+ - spec/wannabe_bool/string_spec.rb
84
+ - spec/wannabe_bool/symbol_spec.rb
83
85
  - wannabe_bool.gemspec
84
86
  homepage: https://github.com/prodis/wannabe_bool
85
87
  licenses:
@@ -101,15 +103,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
103
  version: '0'
102
104
  requirements: []
103
105
  rubyforge_project:
104
- rubygems_version: 2.4.6
106
+ rubygems_version: 2.4.8
105
107
  signing_key:
106
108
  specification_version: 4
107
- summary: 'If string, integer, symbol and nil values wanna be a boolean value, they
109
+ summary: 'If string, numeric, symbol and nil values wanna be a boolean value, they
108
110
  can with the new #to_b method (and more).'
109
111
  test_files:
110
112
  - spec/spec_helper.rb
111
113
  - spec/wannabe_bool/attributes_spec.rb
112
114
  - spec/wannabe_bool/boolean_spec.rb
113
- - spec/wannabe_bool/integer_spec.rb
114
115
  - spec/wannabe_bool/nil_spec.rb
115
- - spec/wannabe_bool/object_spec.rb
116
+ - spec/wannabe_bool/numeric_spec.rb
117
+ - spec/wannabe_bool/string_spec.rb
118
+ - spec/wannabe_bool/symbol_spec.rb
@@ -1,11 +0,0 @@
1
- module WannabeBool
2
- module Integer
3
- def to_b
4
- self != 0
5
- end
6
- end
7
- end
8
-
9
- class Integer
10
- include WannabeBool::Integer
11
- end
@@ -1,23 +0,0 @@
1
- module WannabeBool
2
- module Object
3
- TRUE_VALUES = %W{t true on y yes}.freeze
4
-
5
- def to_b
6
- value = self.to_s.strip.downcase
7
-
8
- if TRUE_VALUES.include?(value)
9
- true
10
- else
11
- value.to_i.to_b
12
- end
13
- end
14
- end
15
- end
16
-
17
- class String
18
- include WannabeBool::Object
19
- end
20
-
21
- class Symbol
22
- include WannabeBool::Object
23
- end
@@ -1,28 +0,0 @@
1
- describe WannabeBool::Integer do
2
- context Integer do
3
- describe '#to_b' do
4
- context 'when value is 0' do
5
- subject { 0 }
6
- it { expect(subject.to_b).to eql false }
7
- end
8
-
9
- context 'positive values' do
10
- (1..9).each do |value|
11
- context "when value is #{value}" do
12
- subject { value }
13
- it { expect(subject.to_b).to eql true }
14
- end
15
- end
16
- end
17
-
18
- context 'negative values' do
19
- (-9..-1).each do |value|
20
- context "when value is #{value}" do
21
- subject { value }
22
- it { expect(subject.to_b).to eql true }
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,84 +0,0 @@
1
- describe WannabeBool::Object do
2
- context String do
3
- describe '#to_b' do
4
- [ '1', '1 ', ' 1', ' 1 ',
5
- '2', '2 ', ' 2', ' 2 ',
6
- '-1', '-1 ', ' -1', ' -1 ',
7
- '-2', '-2 ', ' -2', ' -2 ',
8
- 't', 't ', ' t', ' t ',
9
- 'T', 'T ', ' T', ' T ',
10
- 'true', 'true ', ' true', ' true ',
11
- 'TRUE', 'TRUE ', ' TRUE', ' TRUE ',
12
- 'on', 'on ', ' on', ' on ',
13
- 'ON', 'ON ', ' ON ', ' ON ',
14
- 'y', 'y ', ' y', ' y ',
15
- 'Y', 'Y ', ' Y', ' Y ',
16
- 'yes', 'yes ', ' yes', ' yes ',
17
- 'YES', 'YES ', ' YES', ' YES '
18
- ].each do |value|
19
- context "when value is '#{value}'" do
20
- subject { value }
21
- it { expect(subject.to_b).to eql true }
22
- end
23
- end
24
-
25
- [ '',
26
- '0',
27
- 'f', 'F',
28
- 'false', 'FALSE',
29
- 'off', 'OFF',
30
- 'n', 'N',
31
- 'no', 'NO',
32
- 'not', 'NOT',
33
- 'wherever', 'Prodis'
34
- ].each do |value|
35
- context "when value is '#{value}'" do
36
- subject { value }
37
- it { expect(subject.to_b).to eql false }
38
- end
39
- end
40
- end
41
- end
42
-
43
- context Symbol do
44
- describe '#to_b' do
45
- [ :'1', :'1 ', :' 1 ', :' 1',
46
- :'2', :'2 ', :' 2 ', :' 2',
47
- :'-1', :'-1 ', :' -1 ', :' -1',
48
- :'-2', :'-2 ', :' -2 ', :' -2',
49
- :t, :'t ', :' t', :' t ',
50
- :T, :'T ', :' T', :' T ',
51
- :true, :'true ', :' true', :' true ',
52
- :TRUE, :'TRUE ', :' TRUE', :' TRUE ',
53
- :on, :'on ', :' on', :' on ',
54
- :ON, :'ON ', :' ON ', :' ON ',
55
- :y, :'y ', :' y', :' y ',
56
- :Y, :'Y ', :' Y', :' Y ',
57
- :yes, :'yes ', :' yes', :' yes ',
58
- :YES, :'YES ', :' YES', :' YES '
59
- ].each do |value|
60
- context "when value is '#{value}'" do
61
- subject { value }
62
- it { expect(subject.to_b).to eql true }
63
- end
64
- end
65
-
66
- [ :'',
67
- :'0',
68
- :f, :F,
69
- :false,
70
- :FALSE,
71
- :off, :OFF,
72
- :n, :N,
73
- :no, :NO,
74
- :not, :NOT,
75
- :wherever, :Prodis
76
- ].each do |value|
77
- context "when value is '#{value}'" do
78
- subject { value }
79
- it { expect(subject.to_b).to eql false }
80
- end
81
- end
82
- end
83
- end
84
- end