set_theory 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/LICENSE +20 -0
- data/README.md +55 -0
- data/Rakefile +7 -0
- data/lib/set_theory/version.rb +1 -1
- data/lib/set_theory.rb +0 -3
- data/set_theory.gemspec +3 -0
- data/spec/set_theory/member_of_spec.rb +19 -0
- metadata +50 -8
data/.gemtest
ADDED
File without changes
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Tim Preston
|
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.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
Set Theory
|
2
|
+
==========
|
3
|
+
|
4
|
+
Extends Object with nice names for set operations.
|
5
|
+
|
6
|
+
Installing
|
7
|
+
----------
|
8
|
+
|
9
|
+
gem install set_theory
|
10
|
+
|
11
|
+
_For the whole library_
|
12
|
+
|
13
|
+
require 'set_theory'
|
14
|
+
|
15
|
+
_Or choose the parts you want_
|
16
|
+
|
17
|
+
require 'set_theory/member_of'
|
18
|
+
|
19
|
+
Usage
|
20
|
+
-----
|
21
|
+
|
22
|
+
Development and Testing
|
23
|
+
-----------------------
|
24
|
+
|
25
|
+
#### Requirements
|
26
|
+
|
27
|
+
* rake
|
28
|
+
* bundler
|
29
|
+
* gem-release
|
30
|
+
* rspec
|
31
|
+
|
32
|
+
_Install dependencies_
|
33
|
+
|
34
|
+
bundle install
|
35
|
+
|
36
|
+
_Then run the specs_
|
37
|
+
|
38
|
+
rake
|
39
|
+
|
40
|
+
TODO
|
41
|
+
----
|
42
|
+
|
43
|
+
* Possibly deal with type errors on parameter to member_of?
|
44
|
+
* Add aliases for other set operations.
|
45
|
+
* Add methods for missing set operations.
|
46
|
+
|
47
|
+
Rationale
|
48
|
+
---------
|
49
|
+
Yes, I know about [this patch](https://github.com/rails/rails/pull/265), but I prefer `Object#member_of?` and `!Object#member_of?`.
|
50
|
+
|
51
|
+
Copyright
|
52
|
+
---------
|
53
|
+
See LICENSE for details.
|
54
|
+
|
55
|
+
_Hosted at [RubyGems](http://rubygems.org/gems/set_theory)_
|
data/Rakefile
CHANGED
data/lib/set_theory/version.rb
CHANGED
data/lib/set_theory.rb
CHANGED
data/set_theory.gemspec
CHANGED
@@ -14,6 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.rubyforge_project = "set_theory"
|
16
16
|
|
17
|
+
s.add_development_dependency "gem-release", "~> 0.0.16"
|
18
|
+
s.add_development_dependency "rspec", "~> 2.6.0"
|
19
|
+
|
17
20
|
s.files = `git ls-files`.split("\n")
|
18
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'set_theory/member_of'
|
2
|
+
|
3
|
+
describe Object do
|
4
|
+
it 'responds to #member_of?' do
|
5
|
+
Object.new.respond_to?(:member_of?).should be
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#member_of?' do
|
9
|
+
let(:obj) { "A" }
|
10
|
+
|
11
|
+
it 'returns true when in the set' do
|
12
|
+
obj.member_of?(['A', 'B']).should be
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns false when not in the set' do
|
16
|
+
obj.member_of?(['B', 'C']).should_not be
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: set_theory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Tim Preston
|
@@ -10,10 +14,39 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-05-
|
17
|
+
date: 2011-05-22 00:00:00 +10:00
|
14
18
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: gem-release
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
- 16
|
32
|
+
version: 0.0.16
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 2
|
45
|
+
- 6
|
46
|
+
- 0
|
47
|
+
version: 2.6.0
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
17
50
|
description: Extends Object with nice names for set operations.
|
18
51
|
email:
|
19
52
|
- tim@tp.id.au
|
@@ -24,13 +57,18 @@ extensions: []
|
|
24
57
|
extra_rdoc_files: []
|
25
58
|
|
26
59
|
files:
|
60
|
+
- .gemtest
|
27
61
|
- .gitignore
|
62
|
+
- .rspec
|
28
63
|
- Gemfile
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
29
66
|
- Rakefile
|
30
67
|
- lib/set_theory.rb
|
31
68
|
- lib/set_theory/member_of.rb
|
32
69
|
- lib/set_theory/version.rb
|
33
70
|
- set_theory.gemspec
|
71
|
+
- spec/set_theory/member_of_spec.rb
|
34
72
|
has_rdoc: true
|
35
73
|
homepage: http://github.com/tehpeh/set_theory
|
36
74
|
licenses: []
|
@@ -45,19 +83,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
83
|
requirements:
|
46
84
|
- - ">="
|
47
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
48
88
|
version: "0"
|
49
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
90
|
none: false
|
51
91
|
requirements:
|
52
92
|
- - ">="
|
53
93
|
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
54
96
|
version: "0"
|
55
97
|
requirements: []
|
56
98
|
|
57
99
|
rubyforge_project: set_theory
|
58
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.3.7
|
59
101
|
signing_key:
|
60
102
|
specification_version: 3
|
61
103
|
summary: Extends Object with nice names for set operations.
|
62
|
-
test_files:
|
63
|
-
|
104
|
+
test_files:
|
105
|
+
- spec/set_theory/member_of_spec.rb
|