to_bool 1.2.0 → 2.0.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
  SHA256:
3
- metadata.gz: 339332280a7ae12035e5394e891f10edcf188f5ab9becd14c5b3e658ed2c8c8f
4
- data.tar.gz: 86c824068e09632279c4d8cd8ec4f2b5122eab07c653f2c1dccbd8479c18dd87
3
+ metadata.gz: f74c30f848ad6c680456ade1596e64e56cf300a4679fc043994b731daa77d9d8
4
+ data.tar.gz: 0b138f38fa312c2ff228873db0f04c77dc79f6edffd19bd0772527dae0a3eed0
5
5
  SHA512:
6
- metadata.gz: 5017ce492d24190a1a42fe1ba657bbdf4dc9805ba7897ad5c256a5bd4f79916b401fa549966b8c16bb44a0cf24764eee62cccb917143f4e09096db5d95c4e5ef
7
- data.tar.gz: 867d3180521e6c72c5aa1a412fba8c0469998c4e906d5dcb96a2c832dbe5173ff30f4b65b622384ff1b6e1e3e91aca2826605895da42df7c60be32a8a784ada6
6
+ metadata.gz: d4d3b41a40a2cbc59e5c315879e1f6029c00d975ff6683c9ea6f9a151e7ad88e12284ddff4d69fe83797ca4d1c1f7f3129c6a127e59ed54946f5845fdcb63b20
7
+ data.tar.gz: 7476fb2ee6902dfdf34d0c43467b8d1bf51c9aad895acd58cb9ca2f89c5f52df20ebe19806aff66ff049b9fbc0f21ec5e9b72b3ed996f561c03d8a08f0bbdbb1
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0
4
+ - Added "y" as truthy value for String (Gustav Bertram)
data/README.md CHANGED
@@ -12,7 +12,7 @@ Natural coercion into boolean (true / false). Useful for API interaction.
12
12
 
13
13
  Call `to_bool` on any object. It will *usually* return false, except:
14
14
 
15
- * String: `"true"`, `"1"`, and `"yes"` are true
15
+ * String: `"true"`, `"1"`, `"y"`, and `"yes"` are true
16
16
  * Integer: `1` is true
17
17
  * TrueClass: `true` is true
18
18
  * Symbol: `:true` is true
@@ -1,6 +1,6 @@
1
1
  class String
2
2
  def to_bool
3
- %w{ 1 true yes t }.include? self.downcase
3
+ %w{ 1 true yes t y }.include? self.downcase
4
4
  end
5
5
 
6
6
  alias to_boolean to_bool
@@ -10,6 +10,14 @@ describe "String" do
10
10
  expect("YES".to_bool).to eq true
11
11
  end
12
12
 
13
+ it "is true if 'y'" do
14
+ expect("y".to_bool).to eq true
15
+ end
16
+
17
+ it "is true if 'Y'" do
18
+ expect("Y".to_bool).to eq true
19
+ end
20
+
13
21
  it "is true if '1'" do
14
22
  expect("1".to_bool).to eq true
15
23
  end
@@ -32,7 +40,13 @@ describe "String" do
32
40
 
33
41
  it "is false otherwise" do
34
42
  expect("no".to_bool).to eq false
43
+ expect("NO".to_bool).to eq false
44
+ expect("n".to_bool).to eq false
45
+ expect("N".to_bool).to eq false
35
46
  expect("false".to_bool).to eq false
47
+ expect("FALSE".to_bool).to eq false
48
+ expect("f".to_bool).to eq false
49
+ expect("F".to_bool).to eq false
36
50
  expect("0".to_bool).to eq false
37
51
  end
38
52
 
@@ -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 = "to_bool"
7
- gem.version = "1.2.0"
7
+ gem.version = "2.0.0"
8
8
  gem.authors = ["Bryan Ricker"]
9
9
  gem.email = ["bryancricker@gmail.com"]
10
10
  gem.description = %q{Super-simple gem that extends some Ruby classes with a "to_bool" method, which converts any object naturally into a boolean.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_bool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Ricker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2019-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -33,6 +33,7 @@ extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - ".gitignore"
36
+ - CHANGELOG.md
36
37
  - Gemfile
37
38
  - README.md
38
39
  - Rakefile
@@ -57,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  - !ruby/object:Gem::Version
58
59
  version: '0'
59
60
  requirements: []
60
- rubyforge_project:
61
- rubygems_version: 2.7.6
61
+ rubygems_version: 3.0.3
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Convert any object naturally into a boolean