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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cacdcf660b819e12f5b9aef2999bd8c6c870514
4
- data.tar.gz: f1ac6448967fe9caef2d0171c07ff4666af8e6a8
3
+ metadata.gz: d09bbe5d382d657a9f5b0023d4cbe373255ec1ec
4
+ data.tar.gz: f14c19bfc197c41ce040d9f938082c88c325ad3e
5
5
  SHA512:
6
- metadata.gz: c840b70b5ef956f6d51e1df2c2243b98201dc289b0bfdcc40d2d28c895b7638fe2fd418a149f7050c242b8c29ea23096920b1ec56d38f61cf599e33e210c4642
7
- data.tar.gz: 94b36b355c5b36fde396a07f70ea605c655f52324d024aad71333b15bfeaa16a06d1351c2380a990a6f265bfc47870f1e7a37c8bb275dbb2f424d30a279d27b0
6
+ metadata.gz: c2ad5b0d9c75e39efe48de8bc170593d320193018a9474aa687f6ec508293c9aa093debcfb39f133268106c132fb58df21d3e7e71a5fca6d79fc8d8bcec7a9eb
7
+ data.tar.gz: 88c6892c3a56114923fa55371b12756529dca36573cdc61a59bc7f2e9902fd71b1e40af4466043a874dc65db33a1cb099944ac60657c4bde7fb3d46ec46aa3dc
data/README.md CHANGED
@@ -5,6 +5,40 @@ to_bool
5
5
  [![Build Status](https://travis-ci.org/benSlaughter/to_bool.png?branch=master)](https://travis-ci.org/benSlaughter/to_bool)
6
6
  [![Dependency Status](https://gemnasium.com/benSlaughter/to_bool.png)](https://gemnasium.com/benSlaughter/to_bool)
7
7
  [![Coverage Status](https://coveralls.io/repos/benSlaughter/to_bool/badge.png)](https://coveralls.io/r/benSlaughter/to_bool)
8
- [![Gem Version](https://badge.fury.io/rb/to_bool.png)](http://badge.fury.io/rb/to_bool)
8
+ [![Gem Version](https://badge.fury.io/rb/to_b.png)](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
+ ```
@@ -7,4 +7,8 @@ end
7
7
 
8
8
  class Fixnum
9
9
  include Bool
10
+ end
11
+
12
+ class Symbol
13
+ include Bool
10
14
  end
@@ -1,9 +1,9 @@
1
1
  module Bool
2
2
  def to_b
3
- case self
4
- when /true/i, /yes/i, /t/i, /1/i, 1
3
+ case self.to_s
4
+ when /true/i, /yes/i, /t/i, /1/i
5
5
  true
6
- when /false/i, /no/i, /f/i, /0/i, 0
6
+ when /false/i, /no/i, /f/i, /0/i
7
7
  false
8
8
  end
9
9
  end
@@ -1,4 +1,4 @@
1
1
  module Bool
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.2".freeze
3
3
  DATE = "2013-09-30".freeze
4
4
  end
@@ -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.1
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: