venny 1.0.0 → 1.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.
- data/VERSION +1 -1
- data/lib/venny/std_lib_ext/set.rb +1 -1
- data/spec/venny_spec.rb +4 -0
- data/venny.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
@@ -26,7 +26,7 @@ class Set
|
|
26
26
|
protected
|
27
27
|
def recursive_cartesian_product(*enums)
|
28
28
|
return Set.new([Set.new]) if enums.empty?
|
29
|
-
raise ArgumentError, 'all arguments must be enumerable' unless enums.inject(true) { |acc, element| element.is_a?
|
29
|
+
raise ArgumentError, 'all arguments must be enumerable' unless enums.inject(true) { |acc, element| (acc || !element.is_a?(Enumerable)) }
|
30
30
|
enums = enums.map { |element| element.to_a }.sort { |a, b| b.length <=> a.length }
|
31
31
|
combos = Set.new
|
32
32
|
enums.shift.each do |element|
|
data/spec/venny_spec.rb
CHANGED
@@ -103,6 +103,10 @@ describe Set do
|
|
103
103
|
-> { set.cartesian_product(1) }.should raise_error
|
104
104
|
end
|
105
105
|
|
106
|
+
it 'should throw an error with any non-Enumerable argument' do
|
107
|
+
-> { set.cartesian_product([1,2,3],1,[:a,:b,:c]) }.should raise_error
|
108
|
+
end
|
109
|
+
|
106
110
|
it 'should throw an error if no argument(s) are supplied' do
|
107
111
|
-> { set.cartesian_product }.should raise_error
|
108
112
|
end
|
data/venny.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{venny}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Holland"]
|
12
|
-
s.date = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-29}
|
13
13
|
s.description = %q{Extends the standard library Set object, adding methods for cartesian products, power sets, and complements}
|
14
14
|
s.email = %q{jeremy@jeremypholland.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Holland
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-04-
|
17
|
+
date: 2011-04-29 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
hash: -
|
116
|
+
hash: -4231136223501847886
|
117
117
|
segments:
|
118
118
|
- 0
|
119
119
|
version: "0"
|