Class: TrueClass
- Inherits:
-
Object
- Object
- TrueClass
- Defined in:
- src/object.c
Instance Method Summary collapse
-
#&(obj) ⇒ Boolean
And—Returns
false
if obj isnil
orfalse
,true
otherwise. -
#^(obj) ⇒ Object
Exclusive Or—Returns
true
if obj isnil
orfalse
,false
otherwise. -
#to_s ⇒ Object
The string representation of
true
is “true”. -
#to_s ⇒ Object
The string representation of
true
is “true”. -
#|(obj) ⇒ true
Or—Returns
true
.
Instance Method Details
#&(obj) ⇒ Boolean
And—Returns false
if obj is
nil
or false
, true
otherwise.
113 114 115 116 117 118 119 120 121 |
# File 'src/object.c', line 113 static mrb_value true_and(mrb_state *mrb, mrb_value obj) { mrb_bool obj2; mrb_get_args(mrb, "b", &obj2); return mrb_bool_value(obj2); } |
#^(obj) ⇒ Object
Exclusive Or—Returns true
if obj is
nil
or false
, false
otherwise.
133 134 135 136 137 138 139 140 |
# File 'src/object.c', line 133 static mrb_value true_xor(mrb_state *mrb, mrb_value obj) { mrb_bool obj2; mrb_get_args(mrb, "b", &obj2); return mrb_bool_value(!obj2); } |
#to_s ⇒ Object
The string representation of true
is “true”.
150 151 152 153 154 |
# File 'src/object.c', line 150 static mrb_value true_to_s(mrb_state *mrb, mrb_value obj) { return mrb_str_new_lit_frozen(mrb, "true"); } |
#to_s ⇒ Object
The string representation of true
is “true”.
150 151 152 153 154 |
# File 'src/object.c', line 150 static mrb_value true_to_s(mrb_state *mrb, mrb_value obj) { return mrb_str_new_lit_frozen(mrb, "true"); } |
#|(obj) ⇒ true
Or—Returns true
. As anObject is an argument to
a method call, it is always evaluated; there is no short-circuit
evaluation in this case.
true | puts(“or”) | |
true | puts(“logical or”) |
produces:
or
173 174 175 176 177 |
# File 'src/object.c', line 173 static mrb_value true_or(mrb_state *mrb, mrb_value obj) { return mrb_true_value(); } |