Closed ColinDKelley closed 6 months ago
Hey, thanks for this! I think it's a great PR.
Would you mind looking into the build failures here?
@radar BTW I think the # frozen_string_literal: true
magic comment can help across the board here. I won't clutter this PR with that, but once this is merged, I'll submit another PR that includes that magic comment and then drops .freeze
after all the string constants.
Fine by me regarding FSL.
Rubocop is being a grump. Would you mind fixing that up? I can't push to your branch due to permission restrictions.
Rubocop is being a grump. Would you mind fixing that up? I can't push to your branch due to permission restrictions.
Ah, I'd made this change suppress that rubucop failure but lost it in the merge-up. Merged back here: https://github.com/radar/humanize/pull/88/commits/a347bbb140a6a2d1f1af643c13e6a771e1b57b60
Also, I found I'd missed this recursive call that was depending on the core Integer
class being extended. I've switched it to functional (which will always work): https://github.com/radar/humanize/pull/88/commits/9339246a259e90b046248080726e43e89e496137
And finally, I updated the README to document the new functional usage: https://github.com/radar/humanize/pull/88/commits/32bd066d754d4e04b4ad431ff9268ee4d49d7411
All checks out to me. Thanks very much! ❤️
NOTE Best reviewed by skipping the first commit that moved
humanize.rb
tohumanize/module.rb
and ignoring whitespace: https://github.com/radar/humanize/pull/88/files/a84b371db91fe64c184215df1b147f7a70c8912d..500e185faeb990f4e801d07ec6ac20643249f540Changes
The
Humanize
gem would formerly always duck punch itself into theInteger
,Float
, andBigDecimal
classes.This PR takes inspiration from how
active_support
does core extensions. The core extensions are now optional with this require:And that is required automatically if you
to match previous behavior. But new code has the option to set
require: false
in the Gemfile and just doThen rather than doing
it can instead use the pure functional form (which is always available):
This is useful for code bases that want don't want to duck punch into Ruby core classes.