enummer icon indicating copy to clipboard operation
enummer copied to clipboard

Allow initializing enummer with hash

Open GabrielNagy opened this issue 1 year ago • 4 comments

Similar to the Rails enum behavior, allow initializing an enummer with a hash where the values correspond to the indices of the bits that map to the flag.

This is a more robust and backwards-compatible approach to enums, as the developer doesn't have to worry about migrating historical data if an enum value is removed.

I also took the liberty of running standardrb on the entire project, seeing as the gem is part of the development dependencies.

Thanks again for this useful gem!

GabrielNagy avatar Aug 07 '24 10:08 GabrielNagy

Hi and thanks for the PRs! I'll definitely give them a look as soon as I have a spare moment!

shkm avatar Aug 13 '24 12:08 shkm

Hey hey! Would you mind looking at the conflicts, @GabrielNagy?

shkm avatar Aug 26 '24 07:08 shkm

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (6fd34bf) to head (b051e9e). Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #22   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           70        71    +1     
  Branches         8         9    +1     
=========================================
+ Hits            70        71    +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 26 '24 07:08 codecov[bot]

Hey hey! Would you mind looking at the conflicts, @GabrielNagy?

All done, thanks!

GabrielNagy avatar Aug 26 '24 07:08 GabrielNagy

I've pushed an additional commit to fix another issue I ran into while using enummer. It's completely unrelated to the functionality introduced by the PR at hand but I added it here to avoid conflicts and such.

Let me know if you want me to open a separate PR for it @shkm. Thanks!

GabrielNagy avatar Aug 29 '24 11:08 GabrielNagy

Cheers! Thanks for cutting a new release too 🎉

GabrielNagy avatar Sep 12 '24 10:09 GabrielNagy