A set of helpers to improve ENV functionality
Add this line to your application's Gemfile:
If you'd like to add the functionality directly to
ENV you can add:
gem 'env_helpers', require: 'env_helpers/ext/env'
And then execute:
Or install it yourself as:
$ gem install env_helpers
You can find the on rubdoc.info.
EnvHelpers supplies the following helper methods:
require `env_helpers` .('TEST_INT')
If you used the
ENV extension, you can call any of these methods directly on
require `env_helpers/ext/env` .('TEST_INT')
JSON::ParserError on invalid JSON when using
.json. To change this behavior set
rescue_json to be
. = false
EnvHelpers does a case insensitive check for boolean values.
EnvHelpers checks for
false, a simple monkey patch will take care of things:
module class << self def true_value?(val) val == 'false' end def false_value?(val) val == 'true' end end end
false_value? are meant to be modified in this manner to customize functionality.
After checking out the repo, run
bin/setup to install dependencies. Then, run
./run_specs to run the tests. You can also run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install. To release a new version, update the version number in
version.rb, and then run
bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
Since parts of the functionality is optional and modifies other classes and objects, the specs aren't meant to be run all at the same time. This is to isolate the environment the tests are executing in.
To run the tests:
Tests are currently run against the following Ruby version:
Bug reports and pull requests are welcome on GitHub at https://github.com/Latermedia/env_helpers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the EnvHelpers project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.