Polyfill-data gem adds the Ruby 3.2 Data class to lower Ruby versionsgithub.com/saturnflyer 2 pointssaturnflyer3 years ago1 commentSaveHideCopy link On HNComments−saturnflyerOP3yI'm on a project that isn't yet on ruby 3.2 and wanted to use the new Data class. I implemented this to allow me to move to it easily.It does still have 1 failing test about redefining the initialize method with a block, but it works for all other cases.The Ruby 3.2 Data class is based on C code from Struct. This is all implemented with Ruby.
Comments
I'm on a project that isn't yet on ruby 3.2 and wanted to use the new Data class. I implemented this to allow me to move to it easily.
It does still have 1 failing test about redefining the initialize method with a block, but it works for all other cases.
The Ruby 3.2 Data class is based on C code from Struct. This is all implemented with Ruby.