Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 558 Bytes

README.md

File metadata and controls

36 lines (25 loc) · 558 Bytes

Ruby Boolean

Build Status

This is an extremely simple addition of a Boolean module.

Install:

gem install 'ruby-boolean'

or in your Gemfile

gem 'ruby-boolean'

Its purpose to avoid doing:

foo = true
if foo.is_a?(TrueClass) || foo.is_a?(FalseClass)
  # do something that's specific to booleans
end

Now it can be reduced to:

require 'ruby-boolean'

true.is_a?(Boolean)  #=> true
false.is_a?(Boolean) #=> true
"foo".is_a?(Boolean) #=> false