restricted_set 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/restricted_set.rb +1 -2
- data/lib/restricted_set/version.rb +5 -0
- data/restricted_set.gemspec +6 -4
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f9f7ee179012f06834cd66023bdb70637e71eff
|
4
|
+
data.tar.gz: f2f1816513efa1444baafc04f2b98fc24fbf59ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b43c71c125aa8ecb5dbe867a5aee6f4d507945f20895b0c08a89904d4799a2d7edfc8fc563b94706383020a31d780a082cb8510affdfe63ec0ac784f84a7281
|
7
|
+
data.tar.gz: 1c8a7a96559332f1b53d94b6fb02a2a1d4f8604951a8fd2fca1d2f2f48325cdc4032f6ea73cc13e441650dd252436751679ce43ed8235a478c0c8b07a00d9341
|
data/README.md
CHANGED
@@ -67,6 +67,18 @@ end
|
|
67
67
|
(1..100).to_set(PrimeSet) #=> #<PrimeSet: {2, 3, 5, 7, 11, 13, 17, 19, ...}>
|
68
68
|
```
|
69
69
|
|
70
|
+
```ruby
|
71
|
+
class NullSet < RestrictedSet
|
72
|
+
def initialize(enum = nil)
|
73
|
+
super(enum) { false }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
set = NullSet.new
|
78
|
+
set << 1 << 'a' << :b
|
79
|
+
set #=> #<NullSet: {}>
|
80
|
+
```
|
81
|
+
|
70
82
|
## Contributing
|
71
83
|
|
72
84
|
1. Fork it
|
data/lib/restricted_set.rb
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
# terms as Ruby.
|
10
10
|
|
11
11
|
require "set"
|
12
|
+
require "restricted_set/version"
|
12
13
|
|
13
14
|
class RestrictedSet < Set
|
14
15
|
def initialize(enum = nil, &block)
|
@@ -45,6 +46,4 @@ class RestrictedSet < Set
|
|
45
46
|
def restriction_proc
|
46
47
|
@proc
|
47
48
|
end
|
48
|
-
|
49
|
-
VERSION = "1.0.0"
|
50
49
|
end
|
data/restricted_set.gemspec
CHANGED
@@ -2,12 +2,14 @@
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
|
+
require "restricted_set/version"
|
6
|
+
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = "restricted_set"
|
7
|
-
spec.version =
|
9
|
+
spec.version = RestrictedSet::VERSION
|
8
10
|
spec.authors = ["Danny Whalen"]
|
9
11
|
spec.email = ["daniel.r.whalen@gmail.com"]
|
10
|
-
spec.description = %q{
|
12
|
+
spec.description = %q{Sets with conditional membership defined by a given block.}
|
11
13
|
spec.summary = <<-SUMMARY.gsub(/\n/, ' ').strip
|
12
14
|
RestricedSet implements a set with restrictions defined by a given block.
|
13
15
|
If the block's arity is 2, it is called with the RestrictedSet itself and
|
@@ -16,12 +18,12 @@ the block is called with an object to see if the object is allowed to be
|
|
16
18
|
put in the set.
|
17
19
|
SUMMARY
|
18
20
|
spec.homepage = "https://github.com/invisiblefunnel/restricted_set"
|
19
|
-
spec.license = "
|
21
|
+
spec.license = "2-clause BSDL"
|
20
22
|
|
21
23
|
spec.files = `git ls-files`.split($/)
|
22
24
|
spec.test_files = spec.files.grep(%r{^test/})
|
23
25
|
spec.require_paths = ["lib"]
|
24
26
|
|
25
|
-
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
28
|
spec.add_development_dependency "minitest", "~> 5.0"
|
27
29
|
end
|
metadata
CHANGED
@@ -1,63 +1,64 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restricted_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Whalen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '10.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '10.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '5.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
|
-
description:
|
41
|
+
description: Sets with conditional membership defined by a given block.
|
42
42
|
email:
|
43
43
|
- daniel.r.whalen@gmail.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
50
|
- BSDL
|
51
51
|
- COPYING
|
52
52
|
- Gemfile
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
55
55
|
- lib/restricted_set.rb
|
56
|
+
- lib/restricted_set/version.rb
|
56
57
|
- restricted_set.gemspec
|
57
58
|
- test/restricted_set_test.rb
|
58
59
|
homepage: https://github.com/invisiblefunnel/restricted_set
|
59
60
|
licenses:
|
60
|
-
-
|
61
|
+
- 2-clause BSDL
|
61
62
|
metadata: {}
|
62
63
|
post_install_message:
|
63
64
|
rdoc_options: []
|
@@ -65,17 +66,17 @@ require_paths:
|
|
65
66
|
- lib
|
66
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
68
|
requirements:
|
68
|
-
- -
|
69
|
+
- - ">="
|
69
70
|
- !ruby/object:Gem::Version
|
70
71
|
version: '0'
|
71
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
|
-
- -
|
74
|
+
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
75
76
|
version: '0'
|
76
77
|
requirements: []
|
77
78
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.0
|
79
|
+
rubygems_version: 2.2.0
|
79
80
|
signing_key:
|
80
81
|
specification_version: 4
|
81
82
|
summary: RestricedSet implements a set with restrictions defined by a given block.
|