epitools 0.4.16 → 0.4.17

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.16
1
+ 0.4.17
data/epitools.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{epitools}
8
- s.version = "0.4.16"
8
+ s.version = "0.4.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["epitron"]
@@ -392,8 +392,9 @@ module Enumerable
392
392
  #
393
393
  def powerset
394
394
  # the bit pattern of the numbers from 0..2^(elements)-1 can be used to select the elements of the set...
395
- (0...2**size).map do |bitmask|
396
- select.with_index{ |e, i| bitmask[i] == 1 }
395
+ a = to_a
396
+ (0...2**a.size).map do |bitmask|
397
+ a.select.with_index{ |e, i| bitmask[i] == 1 }
397
398
  end
398
399
  end
399
400
 
@@ -206,7 +206,8 @@ describe Enumerable do
206
206
  end
207
207
 
208
208
  it "powersets" do
209
- [1,2,3].powerset.should == [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
209
+ [1,2,3].powerset.should == [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
210
+ Enum.new([1,2], :each).powerset.should == [[], [1], [2], [1, 2]]
210
211
  end
211
212
 
212
213
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: epitools
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.16
5
+ version: 0.4.17
6
6
  platform: ruby
7
7
  authors:
8
8
  - epitron