struct

Bool

Inherits Value / Object

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.

Constructors

new(pull : JSON::PullParser) : self
Source

Instance methods

!=(other : Bool) : Bool

Returns true if self is not equal to other.

Source
&(other : Bool) : 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
Source
==(other : Bool) : Bool

Returns true if self is equal to other.

Source
^(other : Bool) : 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
Source
|(other : Bool) : 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
Source
clone
Source
hash(hasher)

See Object#hash(hasher)

Source
to_json(json : JSON::Builder) : Nil
Source
to_s(io : IO) : Nil

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

Source
to_s

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

Source
to_unsafe

Returns an integer derived from the boolean value, for interoperability with C-style booleans.

The value is 1 for true and 0 for false.

Source
to_yaml(yaml : YAML::Nodes::Builder) : Nil
Source