Objective3-to_b 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Blake Watters
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = to_b
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 Blake Watters. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "to_b"
8
+ gem.summary = %Q{TODO}
9
+ gem.email = "blake@objective3.com"
10
+ gem.homepage = "http://github.com/blakewatters/to_b"
11
+ gem.authors = ["Blake Watters"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'spec/rake/spectask'
20
+ Spec::Rake::SpecTask.new(:spec) do |spec|
21
+ spec.libs << 'lib' << 'spec'
22
+ spec.spec_files = FileList['spec/**/*_spec.rb']
23
+ end
24
+
25
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.pattern = 'spec/**/*_spec.rb'
28
+ spec.rcov = true
29
+ end
30
+
31
+
32
+ task :default => :spec
33
+
34
+ require 'rake/rdoctask'
35
+ Rake::RDocTask.new do |rdoc|
36
+ if File.exist?('VERSION.yml')
37
+ config = YAML.load(File.read('VERSION.yml'))
38
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
39
+ else
40
+ version = ""
41
+ end
42
+
43
+ rdoc.rdoc_dir = 'rdoc'
44
+ rdoc.title = "to_b #{version}"
45
+ rdoc.rdoc_files.include('README*')
46
+ rdoc.rdoc_files.include('lib/**/*.rb')
47
+ end
48
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/lib/to_b.rb ADDED
@@ -0,0 +1,37 @@
1
+ class String
2
+ def to_b
3
+ return false if self == ''
4
+ return false if self == '0'
5
+ true
6
+ end
7
+ end
8
+
9
+ class NilClass
10
+ def to_b
11
+ return false
12
+ end
13
+ end
14
+
15
+ class TrueClass
16
+ def to_b
17
+ return true
18
+ end
19
+ end
20
+
21
+ class FalseClass
22
+ def to_b
23
+ return false
24
+ end
25
+ end
26
+
27
+ class Object
28
+ def to_b
29
+ return true
30
+ end
31
+ end
32
+
33
+ class Numeric
34
+ def to_b
35
+ self != 0
36
+ end
37
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec'
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require 'to_b'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
data/spec/to_b_spec.rb ADDED
@@ -0,0 +1,54 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe String do
4
+ it "should consider blank strings false" do
5
+ ''.to_b.should == false
6
+ end
7
+
8
+ it "should consider strings equal to '0' as false" do
9
+ '0'.to_b.should == false
10
+ end
11
+
12
+ it "should consider all other strings as true" do
13
+ '12345'.to_b.should == true
14
+ end
15
+ end
16
+
17
+ describe NilClass do
18
+ it "should be false" do
19
+ nil.to_b.should == false
20
+ end
21
+ end
22
+
23
+ describe TrueClass do
24
+ it "should be true" do
25
+ true.to_b.should == true
26
+ end
27
+ end
28
+
29
+ describe FalseClass do
30
+ it "should be false" do
31
+ false.to_b.should == false
32
+ end
33
+ end
34
+
35
+ describe Object do
36
+ it "should be true" do
37
+ Object.new.to_b.should == true
38
+ end
39
+ end
40
+
41
+ describe Numeric do
42
+ it "should consider 0 false" do
43
+ 0.to_b.should == false
44
+ end
45
+
46
+ it "should consider 0.0 false" do
47
+ (0.0).to_b.should == false
48
+ end
49
+
50
+ it "should consider all other numbers true" do
51
+ 1.to_b.should == true
52
+ (1.5).to_b.should == true
53
+ end
54
+ end
data/to_b.gemspec ADDED
@@ -0,0 +1,47 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{to_b}
5
+ s.version = "0.0.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Blake Watters"]
9
+ s.date = %q{2009-08-12}
10
+ s.email = %q{blake@objective3.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "lib/to_b.rb",
23
+ "spec/spec_helper.rb",
24
+ "spec/to_b_spec.rb",
25
+ "to_b.gemspec"
26
+ ]
27
+ s.has_rdoc = true
28
+ s.homepage = %q{http://github.com/blakewatters/to_b}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.1}
32
+ s.summary = %q{TODO}
33
+ s.test_files = [
34
+ "spec/spec_helper.rb",
35
+ "spec/to_b_spec.rb"
36
+ ]
37
+
38
+ if s.respond_to? :specification_version then
39
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
+ s.specification_version = 2
41
+
42
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
43
+ else
44
+ end
45
+ else
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Objective3-to_b
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Blake Watters
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-12 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: blake@objective3.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - .document
27
+ - .gitignore
28
+ - LICENSE
29
+ - README.rdoc
30
+ - Rakefile
31
+ - VERSION
32
+ - lib/to_b.rb
33
+ - spec/spec_helper.rb
34
+ - spec/to_b_spec.rb
35
+ - to_b.gemspec
36
+ has_rdoc: true
37
+ homepage: http://github.com/blakewatters/to_b
38
+ licenses:
39
+ post_install_message:
40
+ rdoc_options:
41
+ - --charset=UTF-8
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.5
60
+ signing_key:
61
+ specification_version: 2
62
+ summary: TODO
63
+ test_files:
64
+ - spec/spec_helper.rb
65
+ - spec/to_b_spec.rb