diff --git a/lib/every.rb b/lib/every.rb index 712018c..f9ef787 100644 --- a/lib/every.rb +++ b/lib/every.rb @@ -1,6 +1,6 @@ module Enumerable class Proxy - instance_methods.each { |m| undef_method(m) unless m.match(/^__/) } + instance_methods.each {|m| undef_method(m) unless m.match(/^__|object_id/) } def initialize(enum, method=:map) @enum, @method = enum, method diff --git a/test/test_every.rb b/test/test_every.rb index 7439eca..79b4a3e 100644 --- a/test/test_every.rb +++ b/test/test_every.rb @@ -5,11 +5,6 @@ describe "Every" do - it "should be a basic object" do - whitelist = %w( __id__ __send__ method_missing ).to_set - Enumerable::Proxy.instance_methods.to_set.must_equal(whitelist.to_set) - end - it "should pass message onto enumerable's items" do [1.4, 2.4, 3.4].every.floor.must_equal([1,2,3]) end @@ -21,4 +16,9 @@ it "should allow blocks" do %w( axb dxf ).every.gsub(/x/) { 'y' }.must_equal(%w( ayb dyf )) end + + it "should be a basic object" do + whitelist = %w( __id__ __send__ method_missing object_id ).every.to_s.to_set + Enumerable::Proxy.instance_methods.every.to_s.to_set.must_equal(whitelist) + end end