From 5b5de3984e31b75643ad3ffc97c149436498c33d Mon Sep 17 00:00:00 2001 From: marcandre Date: Wed, 23 Oct 2013 15:13:57 +0000 Subject: * lib/ostruct.rb (Struct#each_pair): Return an enumerator with size Patch by Kenichi Kamiya. [Fixes GH-383] * test/ostruct/test_ostruct.rb: Added tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/ostruct.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ostruct.rb') diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 3c14454437..d3aea636a1 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -125,7 +125,7 @@ class OpenStruct # data.each_pair.to_a # => [[:country, "Australia"], [:population, 20000000]] # def each_pair - return to_enum __method__ unless block_given? + return to_enum(__method__) { @table.size } unless block_given? @table.each_pair{|p| yield p} end -- cgit v1.2.3