roo-rb / roo

Roo provides an interface to spreadsheets of several sorts.
MIT License
2.78k stars 501 forks source link

Roo::Base#each_with_pagename returns Enumerator Object #576

Closed tsuchiyaisshin closed 1 year ago

tsuchiyaisshin commented 1 year ago

Summary

Generally in ruby, when a method named like "each" called without block returns an Enumerator.

kakubin commented 1 year ago

@tsuchiyaisshin First time contribution 🎉🎉🎉

starchcode commented 1 year ago

How does it change the way we use each_with_pagename? this doesn't work in my project anymore

`spreadsheet.each_with_pagename do |firstvar, secondvar|

some stuff

    end`
starchcode commented 1 year ago

I added another each so it worked. but isn't it strange?

spreadsheet.each_with_pagename.each do |firstvar, secondvar| #somestuff end

starchcode commented 1 year ago

@tsuchiyaisshin @kakubin I forgot to mention you guys on this one. please see my comments above

broksonic21 commented 1 year ago

Seconding @starchcode here. This feels non-standard to me, and surprised us when upgrading. Adding the extra each does work, but is counterintuitive. I definitely suggesting rolling this one back.

starchcode commented 1 year ago

@broksonic21 one way would be to change the name of the function from each_with_pagename to something like pages or anything that makes the most sense this way appending and extra each wouldn't sound strange. Unless there are better ways to work it out

broksonic21 commented 1 year ago

@starchcode that rename would make more sense.

kakubin commented 1 year ago

@starchcode @broksonic21 sorry this change doesn't fit my intention, so I made fix https://github.com/roo-rb/roo/pull/584