class String

Public Instance Methods

to_boolean(default = nil) click to toggle source

Convets to boolean. Returns true for 'true', '1', 'yes', 'on' and 't'. Returns false for 'false', '0', 'no', 'off' and 'f'. @param [Boolean] default Default value to return when the String is not interpretable @return [Boolean] Convered boolean value

# File lib/chime_sdk/controller/common.rb, line 19
def to_boolean(default = nil)
  return true if ['true', '1', 'yes', 'on', 't'].include? self
  return false if ['false', '0', 'no', 'off', 'f'].include? self
  return default
end