kex docs Standard Library

Truthyable

Truthyable — types that can be checked for boolean truthiness (Crystal semantics). Only false, None, and () (Void) are falsy; everything else is truthy. There is no NaN to consider: a float operation that would produce one raises instead, matching BEAM (see nonFiniteFloatError in src/interpreter/value.cxx).

trait Truthyable

Implemented by Bool, Integer, Float, String, Optional<X>, [X], Map<K, V>.

Required methods

An implementor writes these.

truthy?

truthy? : Bool

extends Bool

More methods of Bool, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool

extends Integer

More methods of Integer, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool

extends Float

More methods of Float, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool

extends String

More methods of String, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool

extends Optional<X>

More methods of Optional, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool

extends [X]

More methods of List, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool

extends Map<K, V>

More methods of Map, added by this module.

Implements Truthyable.

truthy? Truthyable

truthy? : Bool