diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/csv.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/csv.rb b/lib/csv.rb index 48c2e97eda..c7649b8842 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -1787,8 +1787,12 @@ class CSV # The data source must be open for reading. # def each - while row = shift - yield row + if block_given? + while row = shift + yield row + end + else + to_enum end end |