class TrueClass
The class of the singleton object true.
Several of its methods act as operators:
One other method:
Public Instance Methods
() → false
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/true_class.rbs, line 16
def !: () -> false
(false | nil) → false
(untyped obj) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/true_class.rbs, line 27
def &: (false | nil) -> false
| (untyped obj) -> bool
Returns false if object is false or nil, true otherwise:
true & Object.new # => true true & false # => false true & nil # => false
(true) → true
(untyped obj) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/true_class.rbs, line 44
def ===: (true) -> true
| (untyped obj) -> bool
(false | nil) → true
(untyped obj) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/true_class.rbs, line 57
def ^: (false | nil) -> true
| (untyped obj) -> bool
Returns true if object is false or nil, false otherwise:
true ^ Object.new # => false true ^ false # => true true ^ nil # => true
(untyped obj) → true
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/true_class.rbs, line 97
def |: (untyped obj) -> true
Returns true:
true | Object.new # => true true | false # => true true | nil # => true
Argument object is evaluated. This is different from true with the short-circuit operator, whose operand is evaluated only if necessary:
true | raise # => Raises RuntimeError. true || raise # => true
() → "true"
Alias for: to_s
(?JSON::State? state) → String
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/json/0/json.rbs, line 1266
def to_json: (?JSON::State? state) -> String
Returns a JSON string for true: ‘true’.
() → "true"
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/true_class.rbs, line 79
def to_s: () -> "true"
Also aliased as: inspect