evt-collection 1.0.0.2 → 1.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/collection.rb +0 -1
- data/lib/collection/collection.rb +16 -0
- metadata +3 -5
- data/lib/collection/refinement.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e40759e369360b8227fd4e37fc25f3336d0bd6ce0a4e4a9b368b8a878d69f39e
|
4
|
+
data.tar.gz: 8eb2d63c51b55be8a897534072418dab744144a1f0a1977a14ac278782857cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ebcdd8cb6718c9f5adb545de726d77683922652a49c295cfea8eb557caac46c2e571bb89334e5dcbb93bf09d247bcda7052dcd5154c9eb5234fbddec20dec30
|
7
|
+
data.tar.gz: 8c1fb5c00e664ad8d2512bfe8d8f62ca767a76677426da6c3730bad8a22fa998e8a014b4f22f3386e846fefb01e4602d63d366251a7a2764ec30da8a3df54a48
|
data/lib/collection.rb
CHANGED
@@ -2,4 +2,20 @@ module Collection
|
|
2
2
|
def self.[](type_parameter)
|
3
3
|
Set[type_parameter]
|
4
4
|
end
|
5
|
+
|
6
|
+
def self.Set(items)
|
7
|
+
items = Array(items)
|
8
|
+
|
9
|
+
raise ArgumentError, "Collection can't be empty" if items.empty?
|
10
|
+
|
11
|
+
type_parameter = items[0].class
|
12
|
+
|
13
|
+
set = Set[type_parameter].new
|
14
|
+
|
15
|
+
items.each do |member|
|
16
|
+
set.add member
|
17
|
+
end
|
18
|
+
|
19
|
+
set
|
20
|
+
end
|
5
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test_bench
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- lib/collection/controls.rb
|
36
36
|
- lib/collection/controls/array.rb
|
37
37
|
- lib/collection/controls/member.rb
|
38
|
-
- lib/collection/refinement.rb
|
39
38
|
- lib/collection/set.rb
|
40
39
|
homepage: https://github.com/eventide-project/collection
|
41
40
|
licenses:
|
@@ -56,8 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
55
|
- !ruby/object:Gem::Version
|
57
56
|
version: '0'
|
58
57
|
requirements: []
|
59
|
-
|
60
|
-
rubygems_version: 2.7.3
|
58
|
+
rubygems_version: 3.0.1
|
61
59
|
signing_key:
|
62
60
|
specification_version: 4
|
63
61
|
summary: Type-checked set
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Collection
|
2
|
-
refine Object do
|
3
|
-
def Collection(items)
|
4
|
-
items = Array(items)
|
5
|
-
|
6
|
-
raise ArgumentError, "Collection can't be empty" if items.empty?
|
7
|
-
|
8
|
-
type_parameter = items[0].class
|
9
|
-
|
10
|
-
set = Set[type_parameter].new
|
11
|
-
|
12
|
-
items.each do |member|
|
13
|
-
set.add member
|
14
|
-
end
|
15
|
-
|
16
|
-
set
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|