Permalink
Browse files

Added Combinatorics::Generator and Combinatorics::Enumerator.

* Auto-detects the Generator and Enumerator classes which are defined in
  different scopes in 1.8 vs. 1.9.
  • Loading branch information...
1 parent 996b03f commit 9ab36caa36539f0f6467b26dcdf35bd53acd1996 @postmodern committed Oct 17, 2010
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{combinatorics}
- s.version = "0.2.0"
+ s.version = "0.3.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Postmodern"]
- s.date = %q{2010-10-16}
+ s.date = %q{2010-10-17}
s.description = %q{A collection of modules and methods for performing Combinatoric calculations.}
s.email = %q{postmodern.mod3@gmail.com}
s.extra_rdoc_files = [
@@ -30,8 +30,10 @@ Gem::Specification.new do |s|
"benchmarks/list_comprehension.rb",
"combinatorics.gemspec",
"lib/combinatorics.rb",
+ "lib/combinatorics/enumerator.rb",
"lib/combinatorics/extensions.rb",
"lib/combinatorics/extensions/range.rb",
+ "lib/combinatorics/generator.rb",
"lib/combinatorics/list_comprehension.rb",
"lib/combinatorics/power_set.rb",
"lib/combinatorics/power_set/extensions.rb",
@@ -40,7 +42,9 @@ Gem::Specification.new do |s|
"lib/combinatorics/power_set/mixin.rb",
"spec/.rspec",
"spec/combinatorics_spec.rb",
+ "spec/enumerator_spec.rb",
"spec/extensions/range_spec.rb",
+ "spec/generator_spec.rb",
"spec/list_comprehension_spec.rb",
"spec/power_set/array_spec.rb",
"spec/power_set/mixin_examples.rb",
@@ -53,8 +57,10 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.3.7}
s.summary = %q{Bringing (more) Combinatorics to Ruby}
s.test_files = [
- "spec/combinatorics_spec.rb",
+ "spec/enumerator_spec.rb",
+ "spec/combinatorics_spec.rb",
"spec/list_comprehension_spec.rb",
+ "spec/generator_spec.rb",
"spec/extensions/range_spec.rb",
"spec/spec_helper.rb",
"spec/power_set/set_spec.rb",
@@ -0,0 +1,9 @@
+require 'enumerator'
+
+module Combinatorics
+ Enumerator = if defined?(::Enumerator) # 1.9
+ ::Enumerator
+ elsif defined?(::Enumerable::Enumerator) # 1.8.7
+ ::Enumerable::Enumerator
+ end
+end
@@ -0,0 +1,9 @@
+require 'generator'
+
+module Combinatorics
+ Generator = if defined?(::Enumerator::Generator) # 1.9
+ ::Enumerator::Generator
+ elsif defined?(::Generator) # 1.8.7
+ ::Generator
+ end
+end
View
@@ -0,0 +1,8 @@
+require 'spec_helper'
+require 'combinatorics/enumerator'
+
+describe Combinatorics::Enumerator do
+ it "should auto-detect the Enumerator class" do
+ Combinatorics::Enumerator.should_not be_nil
+ end
+end
View
@@ -0,0 +1,8 @@
+require 'spec_helper'
+require 'combinatorics/generator'
+
+describe Combinatorics::Generator do
+ it "should auto-detect the Generator class" do
+ Combinatorics::Generator.should_not be_nil
+ end
+end

0 comments on commit 9ab36ca

Please sign in to comment.