wannabe_bool 0.1.1 → 0.2.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: e0e077a67fb3013b3eb8dc8196266f9871de6f12
4
- data.tar.gz: edcbede22bf6a631331c5c90c0572867bb637da5
3
+ metadata.gz: 90543acc9ffc1a5322b89291adfbb46e9de1beb7
4
+ data.tar.gz: 823e9aaed07940f9c33e4128cbe234a0ad9ec1e6
5
5
  SHA512:
6
- metadata.gz: 642c2a59e2588b7691db4d611cc04afd5c7715263fc51c5e93185ae3981d64e8daef56fd54485cb11f93bb8a69d51cee431edf127fda561a1306437dfbd2cd89
7
- data.tar.gz: b4fe55c7580fe66b2899298ffe5c837b79e2a1ba082bde1ee8a3ceac2dd09999415299ace603f6054c947339605505a3574f6697bd64c1378ba857dfc072d0b8
6
+ metadata.gz: 9139f1b720b76f1dbad81c62f2573331e592a6072ee88f0685c06bde5fad2d4eee6511c489d9082dafab2216639d99129752a3b7d5eabf956b47ec08a104cd94
7
+ data.tar.gz: d022be0abce8d6ac2e6d24709ef4a74161f26fc8f59ab39e8e2a736042c3f2bfbf96a0712f92ac3eec544883ce4405b17114ebf57483c74739a2dc7c68b2565c
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
5
- - 2.1.5
6
- - 2.2.2
4
+ - 2.1.7
5
+ - 2.2.3
7
6
  script: bundle exec rspec
@@ -0,0 +1,8 @@
1
+ | Version | Changes |
2
+ | ------- | ------- |
3
+ | 0.2.0 | Minimal required Ruby version is 2.0.0 from now. |
4
+ | 0.1.1 | Remove post install message. |
5
+ | 0.1.0 | New `WannabeBool::Attributes` module to create predicate methods. |
6
+ | 0.0.2 | Gemspec update. |
7
+ | 0.0.1 | First working version. |
8
+ | 0.0.0 | First version, not working yet. |
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014-2015 Fernando Hamasaki de Amorim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,172 @@
1
+ # Wannabe Bool
2
+
3
+ If **string**, **integer**, **symbol** and **nil** values wanna be a **boolean** value, they can with the new `to_b` method.
4
+ Moreover, you can use `WannabeBool::Attributes` module to create predicate methods in your classes.
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/wannabe_bool.svg)](http://badge.fury.io/rb/wannabe_bool)
7
+ [![Build Status](https://travis-ci.org/prodis/wannabe_bool.svg?branch=master)](https://travis-ci.org/prodis/wannabe_bool)
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
+ [![Code Climate](https://codeclimate.com/github/prodis/wannabe_bool/badges/gpa.svg)](https://codeclimate.com/github/prodis/wannabe_bool)
10
+ [![Dependency Status](https://gemnasium.com/prodis/wannabe_bool.svg)](https://gemnasium.com/prodis/wannabe_bool)
11
+
12
+
13
+ ## Installing
14
+
15
+ ### Gemfile
16
+ ```ruby
17
+ gem 'wannabe_bool'
18
+ ```
19
+
20
+ ### Direct installation
21
+ ```
22
+ $ gem install wannabe_bool
23
+ ```
24
+
25
+ ## Using
26
+
27
+ `to_b` method is available on `String`, `Symbol`, `Integer`, `TrueClass`, `FalseClass` and `NilClass`.
28
+
29
+ ```ruby
30
+ require 'wannabe_bool'
31
+ ```
32
+
33
+ #### String
34
+ ```ruby
35
+ '1'.to_b # => true
36
+ 't'.to_b # => true
37
+ 'T'.to_b # => true
38
+ 'true'.to_b # => true
39
+ 'TRUE'.to_b # => true
40
+ 'on'.to_b # => true
41
+ 'ON'.to_b # => true
42
+ 'y'.to_b # => true
43
+ 'yes'.to_b # => true
44
+ 'YES'.to_b # => true
45
+
46
+ ' 1 '.to_b # => true
47
+ ' t '.to_b # => true
48
+ ' T '.to_b # => true
49
+ ' true '.to_b # => true
50
+ ' TRUE '.to_b # => true
51
+ ' on '.to_b # => true
52
+ ' ON '.to_b # => true
53
+ ' y '.to_b # => true
54
+ 'Y'.to_b # => true
55
+ ' Y '.to_b # => true
56
+ ' yes '.to_b # => true
57
+ ' YES '.to_b # => true
58
+
59
+ ''.to_b # => false
60
+ '0'.to_b # => false
61
+ '2'.to_b # => false
62
+ 'f'.to_b # => false
63
+ 'F'.to_b # => false
64
+ 'false'.to_b # => false
65
+ 'FALSE'.to_b # => false
66
+ 'off'.to_b # => false
67
+ 'OFF'.to_b # => false
68
+ 'n'.to_b # => false
69
+ 'N'.to_b # => false
70
+ 'no'.to_b # => false
71
+ 'NO'.to_b # => false
72
+ 'not'.to_b # => false
73
+ 'NOT'.to_b # => false
74
+ 'wherever'.to_b # => false
75
+ ```
76
+
77
+ #### Symbol
78
+ ```ruby
79
+ :1.to_b # => true
80
+ :t.to_b # => true
81
+ :T.to_b # => true
82
+ :true.to_b # => true
83
+ :TRUE.to_b # => true
84
+ :on.to_b # => true
85
+ :ON.to_b # => true
86
+ :y.to_b # => true
87
+ :Y.to_b # => true
88
+ :yes.to_b # => true
89
+ :YES.to_b # => true
90
+
91
+ :f.to_b # => false
92
+ :F.to_b # => false
93
+ :false.to_b # => false
94
+ :FALSE.to_b # => false
95
+ :off.to_b # => false
96
+ :OFF.to_b # => false
97
+ :n.to_b # => false
98
+ :N.to_b # => false
99
+ :no.to_b # => false
100
+ :NO.to_b # => false
101
+ :not.to_b # => false
102
+ :NOT.to_b # => false
103
+ :wherever.to_b # => false
104
+ ```
105
+
106
+ #### Integer
107
+ ```ruby
108
+ 1.to_b # => true
109
+
110
+ 0.to_b # => false
111
+ 2.to_b # => false
112
+ ```
113
+
114
+ #### TrueClass
115
+ ```ruby
116
+ true.to_b # => true
117
+ ```
118
+
119
+ #### FalseClass
120
+ ```ruby
121
+ false.to_b # => false
122
+ ```
123
+
124
+ #### NilClass
125
+ ```ruby
126
+ nil.to_b # => false
127
+ ```
128
+
129
+ Creating predicate methods:
130
+
131
+ ```ruby
132
+ class Fake
133
+ include WannabeBool::Attributes
134
+
135
+ attr_accessor :name, :main, :published
136
+ attr_wannabe_bool :main, :published
137
+ end
138
+
139
+ fake = Fake.new
140
+ fake.main? # => false
141
+ fake.published? # => false
142
+
143
+ fake.main = true
144
+ fake.main? # => true
145
+
146
+ fake.published = 1
147
+ fake.published? # => true
148
+
149
+ fake.main = 'true'
150
+ fake.main? # => true
151
+
152
+ fake.published = :true
153
+ fake.published? # => true
154
+ ```
155
+
156
+ ## Author
157
+ [Fernando Hamasaki de Amorim (prodis)](http://prodis.blog.br)
158
+
159
+ ![Prodis Logo](http://prodis.net.br/images/prodis_150.gif)
160
+
161
+
162
+ ## Contributing to **wannabe_bool**
163
+
164
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
165
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
166
+ - Fork the project.
167
+ - Start a feature/bugfix branch.
168
+ - Commit and push until you are happy with your contribution.
169
+ - Don't forget to rebase with branch master in main project before submit the pull request.
170
+ - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
171
+ - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
172
+
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'wannabe_bool/boolean'
3
2
  require 'wannabe_bool/integer'
4
3
  require 'wannabe_bool/nil'
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WannabeBool
3
2
  module Attributes
4
3
  def self.included(base)
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WannabeBool
3
2
  module Boolean
4
3
  def to_b
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WannabeBool
3
2
  module Integer
4
3
  def to_b
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WannabeBool
3
2
  module Nil
4
3
  def to_b
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WannabeBool
3
2
  module Object
4
3
  TRUE_VALUES = %W{1 t true on y yes}.freeze
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WannabeBool
3
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
4
3
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'coveralls'
3
2
  require 'wannabe_bool'
4
3
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  class Fake
3
2
  include WannabeBool::Attributes
4
3
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  describe WannabeBool::Boolean do
3
2
  context TrueClass do
4
3
  subject { true }
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  describe WannabeBool::Integer do
3
2
  context Integer do
4
3
  describe '#to_b' do
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  describe WannabeBool::Nil do
3
2
  context NilClass do
4
3
  subject { nil }
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  describe WannabeBool::Object do
3
2
  context String do
4
3
  describe '#to_b' do
@@ -5,8 +5,8 @@ require 'wannabe_bool/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'wannabe_bool'
7
7
  spec.version = WannabeBool::VERSION
8
- spec.authors = ['Prodis a.k.a. Fernando Hamasaki de Amorim']
9
- spec.email = ['prodis@gmail.com']
8
+ spec.author = 'Prodis a.k.a. Fernando Hamasaki de Amorim'
9
+ spec.email = 'prodis@gmail.com'
10
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).'
11
11
  spec.description = spec.summary
12
12
  spec.homepage = 'https://github.com/prodis/wannabe_bool'
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.platform = Gem::Platform::RUBY
21
- spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
20
+ spec.platform = Gem::Platform::RUBY
21
+ spec.required_ruby_version = '>= 2.0.0'
22
22
 
23
23
  spec.add_development_dependency 'coveralls'
24
24
  spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'rspec', '~> 3.2'
25
+ spec.add_development_dependency 'rspec'
26
26
  end
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.1.1
4
+ version: 0.2.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-04-22 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -42,32 +42,30 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.2'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.2'
54
+ version: '0'
55
55
  description: 'If string, integer, symbol and nil values wanna be a boolean value,
56
56
  they can with the new #to_b method (and more).'
57
- email:
58
- - prodis@gmail.com
57
+ email: prodis@gmail.com
59
58
  executables: []
60
59
  extensions: []
61
60
  extra_rdoc_files: []
62
61
  files:
63
62
  - ".gitignore"
64
63
  - ".rspec"
65
- - ".ruby-gemset.example"
66
- - ".ruby-version.example"
67
64
  - ".travis.yml"
68
- - CHANGELOG.rdoc
65
+ - CHANGELOG.md
69
66
  - Gemfile
70
- - README.rdoc
67
+ - LICENSE
68
+ - README.md
71
69
  - Rakefile
72
70
  - lib/wannabe_bool.rb
73
71
  - lib/wannabe_bool/attributes.rb
@@ -95,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
93
  requirements:
96
94
  - - ">="
97
95
  - !ruby/object:Gem::Version
98
- version: 1.9.3
96
+ version: 2.0.0
99
97
  required_rubygems_version: !ruby/object:Gem::Requirement
100
98
  requirements:
101
99
  - - ">="
@@ -103,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
101
  version: '0'
104
102
  requirements: []
105
103
  rubyforge_project:
106
- rubygems_version: 2.4.6
104
+ rubygems_version: 2.4.5.1
107
105
  signing_key:
108
106
  specification_version: 4
109
107
  summary: 'If string, integer, symbol and nil values wanna be a boolean value, they
@@ -1 +0,0 @@
1
- wannabe_bool
@@ -1 +0,0 @@
1
- ruby-2.2.2
@@ -1,14 +0,0 @@
1
- == Version 0.1.1
2
- - Remove post install message.
3
-
4
- == Version 0.1.0
5
- - New <code>WannabeBool::Attributes</code> module to create predicate methods.
6
-
7
- == Version 0.0.2
8
- - Gemspec update.
9
-
10
- == Version 0.0.1
11
- - First working version.
12
-
13
- == Version 0.0.0
14
- - First version, not working yet.
@@ -1,181 +0,0 @@
1
- = Wannabe Bool
2
-
3
- If <b>string</b>, <b>integer</b>, <b>symbol</b> and <b>nil</b> values wanna be a <b>boolean</b> value, they can with the new <code>to_b</code> method.
4
- Moreover, you can use <code>WannabeBool::Attributes</code> module to create predicate methods in your classes.
5
-
6
- {<img src="https://badge.fury.io/rb/wannabe_bool.png" alt="Gem Version" />}[http://badge.fury.io/rb/wannabe_bool]
7
- {<img src="https://travis-ci.org/prodis/wannabe_bool.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/prodis/wannabe_bool]
8
- {<img src="https://coveralls.io/repos/prodis/wannabe_bool/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/prodis/wannabe_bool]
9
- {<img src="https://codeclimate.com/github/prodis/wannabe_bool/badges/gpa.svg" alt="Code Climate" />}[https://codeclimate.com/github/prodis/wannabe_bool]
10
-
11
-
12
- == Installing
13
-
14
- === Gemfile
15
- gem 'wannabe_bool'
16
-
17
- === Direct installation
18
- $ gem install wannabe_bool
19
-
20
-
21
- == Using
22
-
23
- <code>to_b</code> method is available on <code>String</code>, <code>Symbol</code>, <code>Integer</code>, <code>TrueClass</code>, <code>FalseClass</code> and <code>NilClass</code>.
24
-
25
- require 'wannabe_bool'
26
-
27
- ==== String
28
- '1'.to_b # => true
29
- 't'.to_b # => true
30
- 'T'.to_b # => true
31
- 'true'.to_b # => true
32
- 'TRUE'.to_b # => true
33
- 'on'.to_b # => true
34
- 'ON'.to_b # => true
35
- 'y'.to_b # => true
36
- 'yes'.to_b # => true
37
- 'YES'.to_b # => true
38
-
39
- ' 1 '.to_b # => true
40
- ' t '.to_b # => true
41
- ' T '.to_b # => true
42
- ' true '.to_b # => true
43
- ' TRUE '.to_b # => true
44
- ' on '.to_b # => true
45
- ' ON '.to_b # => true
46
- ' y '.to_b # => true
47
- 'Y'.to_b # => true
48
- ' Y '.to_b # => true
49
- ' yes '.to_b # => true
50
- ' YES '.to_b # => true
51
-
52
- ''.to_b # => false
53
- '0'.to_b # => false
54
- '2'.to_b # => false
55
- 'f'.to_b # => false
56
- 'F'.to_b # => false
57
- 'false'.to_b # => false
58
- 'FALSE'.to_b # => false
59
- 'off'.to_b # => false
60
- 'OFF'.to_b # => false
61
- 'n'.to_b # => false
62
- 'N'.to_b # => false
63
- 'no'.to_b # => false
64
- 'NO'.to_b # => false
65
- 'not'.to_b # => false
66
- 'NOT'.to_b # => false
67
- 'wherever'.to_b # => false
68
-
69
- ==== Symbol
70
- :1.to_b # => true
71
- :t.to_b # => true
72
- :T.to_b # => true
73
- :true.to_b # => true
74
- :TRUE.to_b # => true
75
- :on.to_b # => true
76
- :ON.to_b # => true
77
- :y.to_b # => true
78
- :Y.to_b # => true
79
- :yes.to_b # => true
80
- :YES.to_b # => true
81
-
82
- :f.to_b # => false
83
- :F.to_b # => false
84
- :false.to_b # => false
85
- :FALSE.to_b # => false
86
- :off.to_b # => false
87
- :OFF.to_b # => false
88
- :n.to_b # => false
89
- :N.to_b # => false
90
- :no.to_b # => false
91
- :NO.to_b # => false
92
- :not.to_b # => false
93
- :NOT.to_b # => false
94
- :wherever.to_b # => false
95
-
96
- ==== Integer
97
- 1.to_b # => true
98
-
99
- 0.to_b # => false
100
- 2.to_b # => false
101
-
102
- ==== TrueClass
103
- true.to_b # => true
104
-
105
- ==== FalseClass
106
- false.to_b # => false
107
-
108
- ==== NilClass
109
- nil.to_b # => false
110
-
111
- Creating predicate methods:
112
-
113
- class Fake
114
- include WannabeBool::Attributes
115
-
116
- attr_accessor :name, :main, :published
117
- attr_wannabe_bool :main, :published
118
- end
119
-
120
- fake = Fake.new
121
- fake.main? # => false
122
- fake.published? # => false
123
-
124
- fake.main = true
125
- fake.main? # => true
126
-
127
- fake.published = 1
128
- fake.published? # => true
129
-
130
- fake.main = 'true'
131
- fake.main? # => true
132
-
133
- fake.published = :true
134
- fake.published? # => true
135
-
136
-
137
- == Author
138
- - {Fernando Hamasaki de Amorim (prodis)}[http://prodis.blog.br]
139
-
140
-
141
- == Contributing to <b>wannabe_bool</b>
142
-
143
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
144
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
145
- * Fork the project.
146
- * Start a feature/bugfix branch.
147
- * Commit and push until you are happy with your contribution.
148
- * Don't forget to rebase with branch master in main project before submit the pull request.
149
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
150
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
151
-
152
-
153
- == Copyright
154
-
155
- (The MIT License)
156
-
157
- {Prodis a.k.a. Fernando Hamasaki de Amorim}[http://prodis.blog.br]
158
-
159
- http://prodis.net.br/images/prodis_150.gif
160
-
161
- Copyright (c) 2014 Prodis
162
-
163
- Permission is hereby granted, free of charge, to any person obtaining
164
- a copy of this software and associated documentation files (the
165
- "Software"), to deal in the Software without restriction, including
166
- without limitation the rights to use, copy, modify, merge, publish,
167
- distribute, sublicense, and/or sell copies of the Software, and to
168
- permit persons to whom the Software is furnished to do so, subject to
169
- the following conditions:
170
-
171
- The above copyright notice and this permission notice shall be
172
- included in all copies or substantial portions of the Software.
173
-
174
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
175
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
176
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
177
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
178
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
179
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
180
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
181
-