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

Superclass hierarchy

Object
Value
Bool

Defined in:

Class Method Summary

Instance Method Summary

Class Method Detail

def self.new(pull : JSON::PullParser)

Instance Method Detail

def !

Negates this boolean.

!true  #=> false
!false #=> true

def &(other : Bool)

Bitwise AND. Returns true if this bool and other are true, otherwise returns false.

false & false #=> false
false & true  #=> false
true  & false #=> false
true  & true  #=> true

def ^(other : Bool)

Exclusive Or. Returns true if this bool is different from other, otherwise returns false.

false ^ false #=> false
false ^ true  #=> true
true  ^ false #=> true
true  ^ true  #=> false

def hash

Returns a hash value for this boolean: 0 for false, 1 for true.


def to_json(io)

def to_s

Returns "true" for true and "false" for false.


def to_s(io)

Appends "true" for true and "false" for false to the given IO.


def |(other : Bool)

Bitwise OR. Returns true if this bool or other is true, otherwise returns false.

false | false #=> false
false | true  #=> true
true  | false #=> true
true  | true  #=> true