At this point I think they are ready for a minor refactoring to name their code with what it's actually doing, ie. they aren't wrapping env, they are configuring their system, so let's have a Configuration class. For getting discrete values, this could look like:
num_retires = Configuration.retry_attempts_count
which could fail immediately if the ENV['RETRY_ATTEMPTS_COUNT'] is not set.
While for configuring boolean values, we could do something like:
show_confidant if Configuration.display_confidential_info?
Which could handle the extra care around true/false ENV parameter parsing by taking advantage of the question mark in the method name convention that Ruby has.
For bonus points wrap that into the existing Rails.application mechanism, so that it's an obvious place for new developers on the project to go to find app parameters.
Nice. I should have known to spend 5 minutes looking for a gem instead of writing a comment. I suppose the parent could have done the same before writing their ENV wrapping and a blog post. ;)
While for configuring boolean values, we could do something like:
Which could handle the extra care around true/false ENV parameter parsing by taking advantage of the question mark in the method name convention that Ruby has.For bonus points wrap that into the existing Rails.application mechanism, so that it's an obvious place for new developers on the project to go to find app parameters.