Module: ToBoolean

Included in:
FalseClass, NilClass, Numeric, String, TrueClass
Defined in:
lib/calpack/api_helper.rb

Overview

Extend types to support to_bool.

Instance Method Summary collapse

Instance Method Details

#to_boolObject



260
261
262
263
# File 'lib/calpack/api_helper.rb', line 260

def to_bool
  return true if self == true || to_s.strip =~ /^(true|yes|y|1)$/i
  false
end