to_b 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +35 -1
- data/lib/to_bool.rb +4 -0
- data/lib/to_bool/bool.rb +3 -3
- data/lib/to_bool/version.rb +1 -1
- data/spec/symbol_spec.rb +29 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d09bbe5d382d657a9f5b0023d4cbe373255ec1ec
|
4
|
+
data.tar.gz: f14c19bfc197c41ce040d9f938082c88c325ad3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ad5b0d9c75e39efe48de8bc170593d320193018a9474aa687f6ec508293c9aa093debcfb39f133268106c132fb58df21d3e7e71a5fca6d79fc8d8bcec7a9eb
|
7
|
+
data.tar.gz: 88c6892c3a56114923fa55371b12756529dca36573cdc61a59bc7f2e9902fd71b1e40af4466043a874dc65db33a1cb099944ac60657c4bde7fb3d46ec46aa3dc
|
data/README.md
CHANGED
@@ -5,6 +5,40 @@ to_bool
|
|
5
5
|
[](https://travis-ci.org/benSlaughter/to_bool)
|
6
6
|
[](https://gemnasium.com/benSlaughter/to_bool)
|
7
7
|
[](https://coveralls.io/r/benSlaughter/to_bool)
|
8
|
-
[](http://badge.fury.io/rb/to_b)
|
9
9
|
|
10
10
|
Extends classes to include the to_b method
|
11
|
+
Currently Extends:
|
12
|
+
* Fixnum
|
13
|
+
* String
|
14
|
+
* Symbol
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem install to_b
|
18
|
+
```
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'to_bool'
|
22
|
+
```
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
1.to_b
|
26
|
+
=> true
|
27
|
+
|
28
|
+
'yes'.to_b
|
29
|
+
=> true
|
30
|
+
|
31
|
+
:t.to_b
|
32
|
+
=> true
|
33
|
+
```
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
0.to_b
|
37
|
+
=> false
|
38
|
+
|
39
|
+
'no'.to_b
|
40
|
+
=> false
|
41
|
+
|
42
|
+
:f.to_b
|
43
|
+
=> false
|
44
|
+
```
|
data/lib/to_bool.rb
CHANGED
data/lib/to_bool/bool.rb
CHANGED
data/lib/to_bool/version.rb
CHANGED
data/spec/symbol_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Symbol do
|
4
|
+
describe "#to_b" do
|
5
|
+
it "returns true when true" do
|
6
|
+
expect(:true.to_b).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns true when yes" do
|
10
|
+
expect(:yes.to_b).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns true when t" do
|
14
|
+
expect(:t.to_b).to be true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns false when false" do
|
18
|
+
expect(:false.to_b).to be false
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns false when no" do
|
22
|
+
expect(:no.to_b).to be false
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns false when f" do
|
26
|
+
expect(:f.to_b).to be false
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_b
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Slaughter
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- spec/fixnum_spec.rb
|
81
81
|
- spec/helper.rb
|
82
82
|
- spec/string_spec.rb
|
83
|
+
- spec/symbol_spec.rb
|
83
84
|
homepage: http://benslaughter.github.io/to_bool/
|
84
85
|
licenses:
|
85
86
|
- MIT
|
@@ -108,4 +109,5 @@ test_files:
|
|
108
109
|
- spec/fixnum_spec.rb
|
109
110
|
- spec/helper.rb
|
110
111
|
- spec/string_spec.rb
|
112
|
+
- spec/symbol_spec.rb
|
111
113
|
has_rdoc:
|