boolean 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/boolean.gemspec +3 -3
- data/lib/boolean.rb +3 -3
- data/spec/boolean_spec.rb +2 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/boolean.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{boolean}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tim Morgan"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-03-16}
|
13
13
|
s.description = %q{This gem extends core classes, adding helpful methods for working with Booleans (such as #to_bool and #parse_bool, and a Boolean type).}
|
14
14
|
s.email = %q{git@timothymorgan.info}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.homepage = %q{http://rubygems.org/gems/boolean}
|
33
33
|
s.licenses = ["MIT"]
|
34
34
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.
|
35
|
+
s.rubygems_version = %q{1.6.2}
|
36
36
|
s.summary = %q{Useful methods for working with Booleans}
|
37
37
|
s.test_files = [
|
38
38
|
"spec/boolean_spec.rb",
|
data/lib/boolean.rb
CHANGED
@@ -73,7 +73,7 @@ class String
|
|
73
73
|
#
|
74
74
|
# @return [true, false] The parsed Boolean value of this string.
|
75
75
|
# @see #parse_bool!
|
76
|
-
def parse_bool() %w( y Y 1 t T ).include? self[0] end
|
76
|
+
def parse_bool() %w( y Y 1 t T ).include? self[0,1] end
|
77
77
|
|
78
78
|
# @see #parse_bool
|
79
79
|
def to_b() parse_bool end
|
@@ -90,9 +90,9 @@ class String
|
|
90
90
|
# "no".parse_bool! #=> false
|
91
91
|
# "maybe".parse_bool! #=> ArgumentError
|
92
92
|
def parse_bool!
|
93
|
-
if %w( y Y 1 t T ).include? self[0] then
|
93
|
+
if %w( y Y 1 t T ).include? self[0,1] then
|
94
94
|
true
|
95
|
-
elsif %w( n N 0 f F ).include? self[0] then
|
95
|
+
elsif %w( n N 0 f F ).include? self[0,1] then
|
96
96
|
false
|
97
97
|
else
|
98
98
|
raise ArgumentError, "Invalid value for parse_bool!: #{inspect}"
|
data/spec/boolean_spec.rb
CHANGED
@@ -83,6 +83,7 @@ describe String do
|
|
83
83
|
"FALSE".send(method).should eql(false)
|
84
84
|
"False".send(method).should eql(false)
|
85
85
|
"0".send(method).should eql(false)
|
86
|
+
"".send(method).should eql(false)
|
86
87
|
|
87
88
|
"m".send(method).should eql(false)
|
88
89
|
"maybe".send(method).should eql(false)
|
@@ -137,6 +138,7 @@ describe String do
|
|
137
138
|
-> { "i don't know".send(method) }.should raise_error(ArgumentError)
|
138
139
|
-> { "I DON'T KNOW".send(method) }.should raise_error(ArgumentError)
|
139
140
|
-> { "I don't know".send(method) }.should raise_error(ArgumentError)
|
141
|
+
-> { "".send(method) }.should raise_error(ArgumentError)
|
140
142
|
end
|
141
143
|
end
|
142
144
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: boolean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tim Morgan
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-03-16 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
hash:
|
95
|
+
hash: -865290202723668340
|
96
96
|
segments:
|
97
97
|
- 0
|
98
98
|
version: "0"
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements: []
|
106
106
|
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.6.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 3
|
111
111
|
summary: Useful methods for working with Booleans
|