utilise 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/License.md +20 -0
- data/README.md +44 -0
- data/lib/utilise/bool.rb +12 -0
- data/lib/utilise/version.rb +4 -0
- data/lib/utilise.rb +14 -0
- data/spec/fixnum_spec.rb +17 -0
- data/spec/helper.rb +9 -0
- data/spec/string_spec.rb +37 -0
- data/spec/symbol_spec.rb +29 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 19376166d11759a4e6b764ca3a51b9a35cdaf4e7
|
4
|
+
data.tar.gz: 7128e03df364cfabdad5b57947db0082b8fb46ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2e956e4b08d625ff52ac07861319a3719b2eafd13c3e820eef3e0c70947c87fe9326d959800c1b4d38f3242baa19a0492aca06f1169bddd552876c948c2414fc
|
7
|
+
data.tar.gz: 428fdea3772309f7eee6242f8f269edfefcaaa2abb160b8ffd22b720438220b18f53f746cbcbb679ffb0edcfa0cb22e2a562d6312a21cc518e29145a43deb4b3
|
data/License.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Ben Slaughter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
Utilise
|
2
|
+
=======
|
3
|
+
|
4
|
+
[![Code Climate](https://codeclimate.com/github/benSlaughter/utilise.png)](https://codeclimate.com/github/benSlaughter/utilise)
|
5
|
+
[![Build Status](https://travis-ci.org/benSlaughter/utilise.png?branch=master)](https://travis-ci.org/benSlaughter/utilise)
|
6
|
+
[![Dependency Status](https://gemnasium.com/benSlaughter/utilise.png)](https://gemnasium.com/benSlaughter/utilise)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/benSlaughter/utilise/badge.png)](https://coveralls.io/r/benSlaughter/utilise)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/utilise.png)](http://badge.fury.io/rb/utilise)
|
9
|
+
|
10
|
+
Extends classes to include the to_bool method
|
11
|
+
Currently Extends:
|
12
|
+
* Fixnum
|
13
|
+
* String
|
14
|
+
* Symbol
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem install utilise
|
18
|
+
```
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'utilise'
|
22
|
+
```
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
1.to_bool
|
26
|
+
=> true
|
27
|
+
|
28
|
+
'yes'.to_bool
|
29
|
+
=> true
|
30
|
+
|
31
|
+
:t.to_bool
|
32
|
+
=> true
|
33
|
+
```
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
0.to_bool
|
37
|
+
=> false
|
38
|
+
|
39
|
+
'no'.to_bool
|
40
|
+
=> false
|
41
|
+
|
42
|
+
:f.to_bool
|
43
|
+
=> false
|
44
|
+
```
|
data/lib/utilise/bool.rb
ADDED
data/lib/utilise.rb
ADDED
data/spec/fixnum_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Fixnum do
|
4
|
+
describe "#to_bool" do
|
5
|
+
it "returns true when 1" do
|
6
|
+
expect(1.to_bool).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns false when 0" do
|
10
|
+
expect(0.to_bool).to be false
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns nil when not 0 or 1" do
|
14
|
+
expect(2.to_bool).to be nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/helper.rb
ADDED
data/spec/string_spec.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
describe "#to_bool" do
|
5
|
+
it "returns true when true" do
|
6
|
+
expect('true'.to_bool).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns true when yes" do
|
10
|
+
expect('yes'.to_bool).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns true when t" do
|
14
|
+
expect('t'.to_bool).to be true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns true when 1" do
|
18
|
+
expect('1'.to_bool).to be true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns false when false" do
|
22
|
+
expect('false'.to_bool).to be false
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns false when no" do
|
26
|
+
expect('no'.to_bool).to be false
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns false when f" do
|
30
|
+
expect('f'.to_bool).to be false
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns false when 0" do
|
34
|
+
expect('0'.to_bool).to be false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/symbol_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Symbol do
|
4
|
+
describe "#to_bool" do
|
5
|
+
it "returns true when true" do
|
6
|
+
expect(:true.to_bool).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns true when yes" do
|
10
|
+
expect(:yes.to_bool).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns true when t" do
|
14
|
+
expect(:t.to_bool).to be true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns false when false" do
|
18
|
+
expect(:false.to_bool).to be false
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns false when no" do
|
22
|
+
expect(:no.to_bool).to be false
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns false when f" do
|
26
|
+
expect(:f.to_bool).to be false
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: utilise
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Slaughter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yard
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.13.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.13.0
|
69
|
+
description: 'Extends a few ruby classes with helpful tools, currently: X.to_bool'
|
70
|
+
email: b.p.slaughter@gmail.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- README.md
|
76
|
+
- License.md
|
77
|
+
- lib/utilise/bool.rb
|
78
|
+
- lib/utilise/version.rb
|
79
|
+
- lib/utilise.rb
|
80
|
+
- spec/fixnum_spec.rb
|
81
|
+
- spec/helper.rb
|
82
|
+
- spec/string_spec.rb
|
83
|
+
- spec/symbol_spec.rb
|
84
|
+
homepage: http://benslaughter.github.io/utilise/
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.0.3
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Utilises a few extra tools
|
108
|
+
test_files:
|
109
|
+
- spec/fixnum_spec.rb
|
110
|
+
- spec/helper.rb
|
111
|
+
- spec/string_spec.rb
|
112
|
+
- spec/symbol_spec.rb
|
113
|
+
has_rdoc:
|