unboolean 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +6 -0
- data/lib/unboolean/core_ext.rb +8 -0
- data/lib/unboolean/maybe.rb +30 -0
- data/lib/unboolean/version.rb +3 -0
- data/lib/unboolean.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/unboolean/maybe_spec.rb +24 -0
- data/spec/unboolean_spec.rb +7 -0
- data/unboolean.gemspec +24 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8df8e469c66e608d5c2f73f260af72aa3e81c211
|
4
|
+
data.tar.gz: a4b70e389958355b3e1b240f99dfd250303feff5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 100d94aec46eb5e3ed573a54b25d45e63cd167694a8ac22e90d99d6579f0358cc0215059a52d617d497720744316f36a58f5191e6e4cc5dd894a5afcb6476703
|
7
|
+
data.tar.gz: bdad018835d7ff7d15d6f6e3c5e423c95b9a0b3a25cca3d08dd1d091e7f84fb094b0bfb195d8f2d9862bec99311ad9b33f895e0fe5acc0c79248b27763f68462
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Alexander Semyonov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Unboolean
|
2
|
+
|
3
|
+
Boolean is too boring. Let’s add `maybe` to `true` and `false`.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'unboolean'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install unboolean
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
maybe == maybe # => maybe
|
23
|
+
|
24
|
+
maybe & true # => maybe
|
25
|
+
maybe & false # => false
|
26
|
+
maybe & maybe # => maybe
|
27
|
+
|
28
|
+
maybe | true # => true
|
29
|
+
maybe | false # => maybe
|
30
|
+
maybe | maybe # => maybe
|
31
|
+
|
32
|
+
maybe ^ true # => maybe
|
33
|
+
maybe ^ false # => maybe
|
34
|
+
maybe ^ maybe # => maybe # Do you think it may not be? No! Everything may be.
|
35
|
+
|
36
|
+
!maybe # => maybe # Yes, it is still may be.
|
37
|
+
```
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'unboolean/version'
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
module Unboolean
|
5
|
+
class Maybe
|
6
|
+
def self.new
|
7
|
+
@__unboolean_maybe_instance ||= super
|
8
|
+
end
|
9
|
+
|
10
|
+
def &(value)
|
11
|
+
value.is_a?(FalseClass) ? false : Maybe.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def |(value)
|
15
|
+
value.is_a?(TrueClass) ? true : Maybe.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def ^(*)
|
19
|
+
Maybe.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def !
|
23
|
+
Maybe.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def ==(*)
|
27
|
+
Maybe.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/unboolean.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Unboolean::Maybe do
|
4
|
+
subject(:maybe) { described_class.new }
|
5
|
+
|
6
|
+
specify('maybe MAY BE maybe') { expect(maybe).to eql(maybe) }
|
7
|
+
specify('NOT maybe may be maybe') { expect(!maybe).to eql(maybe) }
|
8
|
+
|
9
|
+
specify('maybe MAY BE equal to maybe') { expect(maybe == maybe).to eql(maybe) }
|
10
|
+
specify('maybe MAY BE equal to true') { expect(maybe == true).to eql(maybe) }
|
11
|
+
specify('maybe MAY BE equal to false') { expect(maybe == false).to eql(maybe) }
|
12
|
+
|
13
|
+
specify('maybe AND true may be maybe') { expect(maybe & true).to eql(maybe) }
|
14
|
+
specify('maybe AND false may be false') { expect(maybe & false).to eql(false) }
|
15
|
+
specify('maybe AND maybe may be maybe') { expect(maybe & maybe).to eql(maybe) }
|
16
|
+
|
17
|
+
specify('maybe OR true should be true') { expect(maybe | true).to eql(true) }
|
18
|
+
specify('maybe OR false may be maybe') { expect(maybe | false).to eql(maybe) }
|
19
|
+
specify('maybe OR maybe may be maybe') { expect(maybe | maybe).to eql(maybe) }
|
20
|
+
|
21
|
+
specify('maybe XOR true may be maybe') { expect(maybe ^ true).to eql(maybe) }
|
22
|
+
specify('maybe XOR false may be maybe') { expect(maybe ^ false).to eql(maybe) }
|
23
|
+
specify('maybe XOR maybe may be maybe') { expect(maybe ^ maybe).to eql(maybe) }
|
24
|
+
end
|
data/unboolean.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'unboolean/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'unboolean'
|
8
|
+
spec.version = Unboolean::VERSION
|
9
|
+
spec.authors = ['Alexander Semyonov']
|
10
|
+
spec.email = %w(al@semyonov.us)
|
11
|
+
spec.description = %q{Boolean is too boring. Let’s add Maybe value.}
|
12
|
+
spec.summary = %q{True, false, or Maybe?}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = %w(lib)
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unboolean
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Semyonov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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: rspec
|
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
|
+
description: Boolean is too boring. Let’s add Maybe value.
|
56
|
+
email:
|
57
|
+
- al@semyonov.us
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- lib/unboolean.rb
|
70
|
+
- lib/unboolean/core_ext.rb
|
71
|
+
- lib/unboolean/maybe.rb
|
72
|
+
- lib/unboolean/version.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
- spec/unboolean/maybe_spec.rb
|
75
|
+
- spec/unboolean_spec.rb
|
76
|
+
- unboolean.gemspec
|
77
|
+
homepage: ''
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.1.9
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: True, false, or Maybe?
|
101
|
+
test_files:
|
102
|
+
- spec/spec_helper.rb
|
103
|
+
- spec/unboolean/maybe_spec.rb
|
104
|
+
- spec/unboolean_spec.rb
|