Module: BooleanClass::Conversion

Included in:
Object
Defined in:
lib/boolean_class/conversion.rb

Instance Method Summary collapse

Instance Method Details

#Boolean(value) ⇒ Boolean

Performs type conversion from anything to true/false

Examples:

True values

Boolean(true)  #=> true
Boolean(999)   #=> true
Boolean(0)     #=> true

False values

Boolean(false) #=> false
Boolean(nil)   #=> false

Parameters:

  • value (Object)

    the object to coerce

Returns:

  • (Boolean)

    false when value is either false or nil otherwise returns true



19
20
21
# File 'lib/boolean_class/conversion.rb', line 19

def Boolean(value)
  value ? true : false
end