PHP to Ruby
Convert PHP code into Ruby!
-
is_bool
Posted on August 1st, 2009 No commentsThe is_bool() function allows you to check if a particular variable is a boolean (type).
PHP
$my_variable = 1; var_dump( is_bool($my_variable) ); // => false
Ruby
my_variable = 1; puts my_variable.is_a?(FalseClass) || my_variable.is_a?(TrueClass) # => false
Leave a reply


