Class: NilClass
Instance Method Summary collapse
-
#& ⇒ Object
And—Returns
false. -
#^ ⇒ Object
Exclusive Or—If obj is
nilorfalse, returnsfalse; otherwise, returnstrue. -
#inspect ⇒ Object
15.2.4.3.5.
-
#nil? ⇒ Boolean
call_seq: nil.nil? -> true.
-
#to_a ⇒ Array
Always returns an empty array.
-
#to_f ⇒ 0.0
Always returns zero.
-
#to_i ⇒ 0
Always returns zero.
-
#to_s ⇒ Object
Always returns the empty string.
-
#| ⇒ Object
Or—Returns
falseif obj isnilorfalse;trueotherwise.
Instance Method Details
#&(obj) ⇒ false #&(obj) ⇒ false
And—Returns false. obj is always
evaluated as it is the argument to a method call—there is no
short-circuit evaluation in this case.
201 202 203 204 205 |
# File 'src/object.c', line 201 static mrb_value false_and(mrb_state *mrb, mrb_value obj) { return mrb_false_value(); } |
#^(obj) ⇒ Boolean #^(obj) ⇒ Boolean
Exclusive Or—If obj is nil or
false, returns false; otherwise, returns
true.
220 221 222 223 224 225 226 227 |
# File 'src/object.c', line 220 static mrb_value false_xor(mrb_state *mrb, mrb_value obj) { mrb_bool obj2; mrb_get_args(mrb, "b", &obj2); return mrb_bool_value(obj2); } |
#inspect ⇒ Object
15.2.4.3.5
89 90 91 92 93 |
# File 'src/object.c', line 89 static mrb_value nil_inspect(mrb_state *mrb, mrb_value obj) { return mrb_str_new_lit(mrb, "nil"); } |
#nil? ⇒ Boolean
call_seq: nil.nil? -> true
Only the object nil responds true to nil?.
69 70 71 72 73 |
# File 'src/object.c', line 69 static mrb_value mrb_true(mrb_state *mrb, mrb_value obj) { return mrb_true_value(); } |
#to_a ⇒ Array
Always returns an empty array.
13 14 15 16 17 |
# File 'mrbgems/mruby-object-ext/src/object.c', line 13 static mrb_value nil_to_a(mrb_state *mrb, mrb_value obj) { return mrb_ary_new(mrb); } |
#to_f ⇒ 0.0
Always returns zero.
27 28 29 30 31 |
# File 'mrbgems/mruby-object-ext/src/object.c', line 27 static mrb_value nil_to_f(mrb_state *mrb, mrb_value obj) { return mrb_float_value(mrb, 0.0); } |
#to_i ⇒ 0
Always returns zero.
41 42 43 44 45 |
# File 'mrbgems/mruby-object-ext/src/object.c', line 41 static mrb_value nil_to_i(mrb_state *mrb, mrb_value obj) { return mrb_fixnum_value(0); } |
#to_s ⇒ Object
Always returns the empty string.
83 84 85 86 87 |
# File 'src/object.c', line 83 static mrb_value nil_to_s(mrb_state *mrb, mrb_value obj) { return mrb_str_new(mrb, 0, 0); } |
#|(obj) ⇒ Boolean #|(obj) ⇒ Boolean
Or—Returns false if obj is
nil or false; true otherwise.
240 241 242 243 244 245 246 247 |
# File 'src/object.c', line 240 static mrb_value false_or(mrb_state *mrb, mrb_value obj) { mrb_bool obj2; mrb_get_args(mrb, "b", &obj2); return mrb_bool_value(obj2); } |