struct Bool

Overview

Bool has only two possible values: true and false. They are constructed using these literals:

true  # A Bool that is true
false # A Bool that is false

See Bool literals in the language reference.

Defined in:

bool/inverted.cr

Instance Method Summary

Instance methods inherited from class Object

methods : Array(String) methods, pipe(&) pipe, selftap(&) selftap

Instance Method Detail

def inverted #

Inverts a bool

This provides a convenient inversion method for use in method chains.

is_hidden = true

is_hidden
  .inverted
  .map { |b| b ? "yes" : "no" }

[View source]