summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--complex.c7
-rw-r--r--object.c146
-rw-r--r--rational.c17
3 files changed, 118 insertions, 52 deletions
@@ -1692,9 +1692,12 @@ nucomp_to_c(VALUE self)
/*
* call-seq:
- * nil.to_c -> (0+0i)
*
- * Returns zero as a complex.
*/
static VALUE
nilclass_to_c(VALUE self)
@@ -106,13 +106,17 @@ rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
return obj;
}
-/**
- * call-seq:
- * obj === other -> true or false
*
- * Case Equality -- For class Object, effectively the same as calling
- * <code>#==</code>, but typically overridden by descendants to provide
- * meaningful semantics in +case+ statements.
*/
#define case_equal rb_equal
/* The default implementation of #=== is
@@ -1251,14 +1255,44 @@ rb_obj_frozen_p(VALUE obj)
/*
* Document-class: NilClass
*
- * The class of the singleton object <code>nil</code>.
*/
/*
- * call-seq:
- * nil.to_s -> ""
*
- * Always returns the empty string.
*/
VALUE
@@ -1270,12 +1304,13 @@ rb_nil_to_s(VALUE obj)
/*
* Document-method: to_a
*
- * call-seq:
- * nil.to_a -> []
*
- * Always returns an empty array.
*
- * nil.to_a #=> []
*/
static VALUE
@@ -1287,12 +1322,13 @@ nil_to_a(VALUE obj)
/*
* Document-method: to_h
*
- * call-seq:
- * nil.to_h -> {}
*
- * Always returns an empty hash.
*
- * nil.to_h #=> {}
*/
static VALUE
@@ -1302,10 +1338,13 @@ nil_to_h(VALUE obj)
}
/*
- * call-seq:
- * nil.inspect -> "nil"
*
- * Always returns the string "nil".
*/
static VALUE
@@ -1315,12 +1354,17 @@ nil_inspect(VALUE obj)
}
/*
- * call-seq:
- * nil =~ other -> nil
*
- * Dummy pattern matching -- always returns nil.
*
- * This method makes it possible to `while gets =~ /re/ do`.
*/
static VALUE
@@ -1430,15 +1474,20 @@ rb_false_to_s(VALUE obj)
}
/*
- * call-seq:
- * false & obj -> false
- * nil & obj -> false
*
- * And---Returns <code>false</code>. <i>obj</i> is always
- * evaluated as it is the argument to a method call---there is no
- * short-circuit evaluation in this case.
*/
-
static VALUE
false_and(VALUE obj, VALUE obj2)
{
@@ -1447,24 +1496,30 @@ false_and(VALUE obj, VALUE obj2)
/*
- * call-seq:
- * false | obj -> true or false
- * nil | obj -> true or false
*
- * Or---Returns <code>false</code> if <i>obj</i> is
- * <code>nil</code> or <code>false</code>; <code>true</code> otherwise.
*/
#define false_or true_and
/*
- * call-seq:
- * false ^ obj -> true or false
- * nil ^ obj -> true or false
*
- * Exclusive Or---If <i>obj</i> is <code>nil</code> or
- * <code>false</code>, returns <code>false</code>; otherwise, returns
- * <code>true</code>.
*
*/
@@ -1472,9 +1527,10 @@ false_and(VALUE obj, VALUE obj2)
/*
* call-seq:
- * nil.nil? -> true
*
- * Only the object <i>nil</i> responds <code>true</code> to <code>nil?</code>.
*/
static VALUE
@@ -2103,9 +2103,12 @@ rb_float_denominator(VALUE self)
/*
* call-seq:
- * nil.to_r -> (0/1)
*
- * Returns zero as a rational.
*/
static VALUE
nilclass_to_r(VALUE self)
@@ -2115,10 +2118,14 @@ nilclass_to_r(VALUE self)
/*
* call-seq:
- * nil.rationalize([eps]) -> (0/1)
*
- * Returns zero as a rational. The optional argument +eps+ is always
- * ignored.
*/
static VALUE
nilclass_rationalize(int argc, VALUE *argv, VALUE self)