Add .to_bool
behaviour to the follow classes:
- String
- Integer
- Float
- Array
- Hash
- TrueClass
- FalseClass
- NilClass
Add this line to your application's Gemfile:
gem 'extends_bool'
And then execute:
$ bundle
Or install it yourself as:
$ gem install extends_bool
Simple, if the variable have any of [nil, false, 0, 0.0, "", "0", "f", "false", "off", [], {}]
values, will return false
, else, returns true
.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/extends_bool. 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.
Everyone interacting in the ExtendsBool project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.