Utilise

Code Climate Build Status Dependency Status Coverage Status Gem Version

Extends classes to include the to_bool method

Currently extends:

  • Fixnum
  • String
  • Symbol
  • Hash
  • Array
  • Object

Hashes and Arrays will have all values iterated.

gem install utilise
require 'utilise'
1.to_bool
=> true

'yes'.to_bool
=> true

:t.to_bool
=> true

{'key' => 1}.to_bool
=> {'key' => true}

[1].to_bool
=> [true]
0.to_bool
=> false

'no'.to_bool
=> false

:f.to_bool
=> false

{'key' => 0}.to_bool
=> {'key' => false}

[0].to_bool
=> [false]
Time.unique
=> "80347765"
true.is_bool?
=> true

false.is_bool?
=> true

1.is_bool?
=> false

"true".is_bool?
=> false