Skip to content

Adds ".to_bool" behaviour to String, Integer, Float, Array, Hash, TrueClass, FalseClass and NilClass.

License

Notifications You must be signed in to change notification settings

andreleoni/extends_bool

Repository files navigation

ExtendsBool

Maintainability Build Status

Add .to_bool behaviour to the follow classes:

  • String
  • Integer
  • Float
  • Array
  • Hash
  • TrueClass
  • FalseClass
  • NilClass

Installation

Add this line to your application's Gemfile:

gem 'extends_bool'

And then execute:

$ bundle

Or install it yourself as:

$ gem install extends_bool

Usage

Simple, if the variable have any of [nil, false, 0, 0.0, "", "0", "f", "false", "off", [], {}] values, will return false, else, returns true.

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the ExtendsBool project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Adds ".to_bool" behaviour to String, Integer, Float, Array, Hash, TrueClass, FalseClass and NilClass.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published