[DOC] Fill undocumented documents

This commit is contained in:
Nobuyoshi Nakada 2025-08-04 02:23:43 +09:00
parent b4dfdb915d
commit 6179cc0118
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465
12 changed files with 103 additions and 3 deletions

View file

@ -1988,6 +1988,7 @@ Init_unicode_version(void)
VALUE str = rb_usascii_str_new_static(onigenc_unicode_version_string, VALUE str = rb_usascii_str_new_static(onigenc_unicode_version_string,
strlen(onigenc_unicode_version_string)); strlen(onigenc_unicode_version_string));
OBJ_FREEZE(str); OBJ_FREEZE(str);
/* The supported Unicode version. */
rb_define_const(rb_cEncoding, "UNICODE_VERSION", str); rb_define_const(rb_cEncoding, "UNICODE_VERSION", str);
} }

12
error.c
View file

@ -3499,6 +3499,18 @@ syserr_eqq(VALUE self, VALUE exc)
* incompatible with the target encoding. * incompatible with the target encoding.
*/ */
/*
* Document-class: NoMatchingPatternError
*
* Raised when matching pattern not found.
*/
/*
* Document-class: NoMatchingPatternKeyError
*
* Raised when matching key not found.
*/
/* /*
* Document-class: fatal * Document-class: fatal
* *

View file

@ -411,6 +411,12 @@ rb_get_namespace_object(rb_namespace_t *ns)
static void setup_pushing_loading_namespace(rb_namespace_t *ns); static void setup_pushing_loading_namespace(rb_namespace_t *ns);
/*
* call-seq:
* Namespace.new -> new_namespace
*
* Returns a new Namespace object.
*/
static VALUE static VALUE
namespace_initialize(VALUE namespace) namespace_initialize(VALUE namespace)
{ {
@ -450,12 +456,26 @@ namespace_initialize(VALUE namespace)
return namespace; return namespace;
} }
/*
* call-seq:
* Namespace.enabled? -> true or false
*
* Returns +true+ if namespace is enabled.
*/
static VALUE static VALUE
rb_namespace_s_getenabled(VALUE namespace) rb_namespace_s_getenabled(VALUE namespace)
{ {
return RBOOL(rb_namespace_available()); return RBOOL(rb_namespace_available());
} }
/*
* call-seq:
* Namespace.current -> namespace, nil or false
*
* Returns the current namespace.
* Returns +nil+ if it is the built-in namespace.
* Returns +false+ if namespace is not enabled.
*/
static VALUE static VALUE
rb_namespace_current(VALUE klass) rb_namespace_current(VALUE klass)
{ {
@ -469,6 +489,12 @@ rb_namespace_current(VALUE klass)
return Qfalse; return Qfalse;
} }
/*
* call-seq:
* Namespace.is_builtin?(klass) -> true or false
*
* Returns +true+ if +klass+ is only in a user namespace.
*/
static VALUE static VALUE
rb_namespace_s_is_builtin_p(VALUE namespace, VALUE klass) rb_namespace_s_is_builtin_p(VALUE namespace, VALUE klass)
{ {
@ -477,6 +503,12 @@ rb_namespace_s_is_builtin_p(VALUE namespace, VALUE klass)
return Qfalse; return Qfalse;
} }
/*
* call-seq:
* load_path -> array
*
* Returns namespace local load path.
*/
static VALUE static VALUE
rb_namespace_load_path(VALUE namespace) rb_namespace_load_path(VALUE namespace)
{ {
@ -1048,6 +1080,13 @@ Init_enable_namespace(void)
} }
} }
/*
* Document-class: Namespace
*
* Namespace is designed to provide separated spaces in a Ruby
* process, to isolate applications and libraries.
* See {Namespace}[rdoc-ref:namespace.md].
*/
void void
Init_Namespace(void) Init_Namespace(void)
{ {
@ -1057,14 +1096,17 @@ Init_Namespace(void)
rb_cNamespace = rb_define_class("Namespace", rb_cModule); rb_cNamespace = rb_define_class("Namespace", rb_cModule);
rb_define_method(rb_cNamespace, "initialize", namespace_initialize, 0); rb_define_method(rb_cNamespace, "initialize", namespace_initialize, 0);
/* :nodoc: */
rb_cNamespaceEntry = rb_define_class_under(rb_cNamespace, "Entry", rb_cObject); rb_cNamespaceEntry = rb_define_class_under(rb_cNamespace, "Entry", rb_cObject);
rb_define_alloc_func(rb_cNamespaceEntry, rb_namespace_entry_alloc); rb_define_alloc_func(rb_cNamespaceEntry, rb_namespace_entry_alloc);
/* :nodoc: */
rb_mNamespaceRefiner = rb_define_module_under(rb_cNamespace, "Refiner"); rb_mNamespaceRefiner = rb_define_module_under(rb_cNamespace, "Refiner");
if (rb_namespace_available()) { if (rb_namespace_available()) {
setup_builtin_refinement(rb_mNamespaceRefiner); setup_builtin_refinement(rb_mNamespaceRefiner);
} }
/* :nodoc: */
rb_mNamespaceLoader = rb_define_module_under(rb_cNamespace, "Loader"); rb_mNamespaceLoader = rb_define_module_under(rb_cNamespace, "Loader");
namespace_define_loader_method("require"); namespace_define_loader_method("require");
namespace_define_loader_method("require_relative"); namespace_define_loader_method("require_relative");

View file

@ -12,6 +12,7 @@
class Pathname class Pathname
# The version string.
VERSION = "0.4.0" VERSION = "0.4.0"
# :stopdoc: # :stopdoc:

View file

@ -15,15 +15,17 @@ class Binding
end end
module Kernel module Kernel
# :stopdoc:
def pp(*objs) def pp(*objs)
require 'pp' require 'pp'
pp(*objs) pp(*objs)
end end
# suppress redefinition warning # suppress redefinition warning
alias pp pp # :nodoc: alias pp pp
private :pp private :pp
# :startdoc:
end end
module Enumerable module Enumerable

6
proc.c
View file

@ -2026,6 +2026,12 @@ method_owner(VALUE obj)
return data->owner; return data->owner;
} }
/*
* call-see:
* meth.namespace -> namespace or nil
*
* Returns the namespace where +meth+ is defined in.
*/
static VALUE static VALUE
method_namespace(VALUE obj) method_namespace(VALUE obj)
{ {

View file

@ -874,6 +874,12 @@ ractor_moved_missing(int argc, VALUE *argv, VALUE self)
rb_raise(rb_eRactorMovedError, "can not send any methods to a moved object"); rb_raise(rb_eRactorMovedError, "can not send any methods to a moved object");
} }
/*
* Document-class: Ractor::Error
*
* The parent class of Ractor-related error classes.
*/
/* /*
* Document-class: Ractor::ClosedError * Document-class: Ractor::ClosedError
* *
@ -911,6 +917,13 @@ ractor_moved_missing(int argc, VALUE *argv, VALUE self)
* Continue successfully * Continue successfully
*/ */
/*
* Document-class: Ractor::IsolationError
*
* Raised on attempt to make a Ractor-unshareable object
* Ractor-shareable.
*/
/* /*
* Document-class: Ractor::RemoteError * Document-class: Ractor::RemoteError
* *
@ -960,6 +973,12 @@ ractor_moved_missing(int argc, VALUE *argv, VALUE self)
* # Ractor::MovedError (can not send any methods to a moved object) * # Ractor::MovedError (can not send any methods to a moved object)
*/ */
/*
* Document-class: Ractor::UnsafeError
*
* Raised when Ractor-unsafe C-methods is invoked by a non-main Ractor.
*/
// Main docs are in ractor.rb, but without this clause there are weird artifacts // Main docs are in ractor.rb, but without this clause there are weird artifacts
// in their rendering. // in their rendering.
/* /*

View file

@ -612,6 +612,7 @@ class Ractor
__builtin_ractor_unmonitor(port) __builtin_ractor_unmonitor(port)
end end
# \Port objects transmit messages between Ractors.
class Port class Port
# #
# call-seq: # call-seq:

View file

@ -91,12 +91,19 @@ ractor_port_init(VALUE rpv, rb_ractor_t *r)
return rpv; return rpv;
} }
/*
* call-seq:
* Ractor::Port.new -> new_port
*
* Returns a new Ractor::Port object.
*/
static VALUE static VALUE
ractor_port_initialzie(VALUE self) ractor_port_initialzie(VALUE self)
{ {
return ractor_port_init(self, GET_RACTOR()); return ractor_port_init(self, GET_RACTOR());
} }
/* :nodoc: */
static VALUE static VALUE
ractor_port_initialzie_copy(VALUE self, VALUE orig) ractor_port_initialzie_copy(VALUE self, VALUE orig)
{ {

1
re.c
View file

@ -4855,6 +4855,7 @@ Init_Regexp(void)
rb_define_method(rb_cRegexp, "named_captures", rb_reg_named_captures, 0); rb_define_method(rb_cRegexp, "named_captures", rb_reg_named_captures, 0);
rb_define_method(rb_cRegexp, "timeout", rb_reg_timeout_get, 0); rb_define_method(rb_cRegexp, "timeout", rb_reg_timeout_get, 0);
/* Raised when regexp matching timed out. */
rb_eRegexpTimeoutError = rb_define_class_under(rb_cRegexp, "TimeoutError", rb_eRegexpError); rb_eRegexpTimeoutError = rb_define_class_under(rb_cRegexp, "TimeoutError", rb_eRegexpError);
rb_define_singleton_method(rb_cRegexp, "timeout", rb_reg_s_timeout_get, 0); rb_define_singleton_method(rb_cRegexp, "timeout", rb_reg_s_timeout_get, 0);
rb_define_singleton_method(rb_cRegexp, "timeout=", rb_reg_s_timeout_set, 1); rb_define_singleton_method(rb_cRegexp, "timeout=", rb_reg_s_timeout_set, 1);

View file

@ -798,7 +798,7 @@ rb_fiber_scheduler_io_read(VALUE scheduler, VALUE io, VALUE buffer, size_t lengt
} }
/* /*
* Document-method: Fiber::Scheduler#io_read * Document-method: Fiber::Scheduler#io_pread
* call-seq: io_pread(io, buffer, from, length, offset) -> read length or -errno * call-seq: io_pread(io, buffer, from, length, offset) -> read length or -errno
* *
* Invoked by IO#pread or IO::Buffer#pread to read +length+ bytes from +io+ * Invoked by IO#pread or IO::Buffer#pread to read +length+ bytes from +io+
@ -837,7 +837,7 @@ rb_fiber_scheduler_io_pread(VALUE scheduler, VALUE io, rb_off_t from, VALUE buff
} }
/* /*
* Document-method: Scheduler#io_write * Document-method: Fiber::Scheduler#io_write
* call-seq: io_write(io, buffer, length, offset) -> written length or -errno * call-seq: io_write(io, buffer, length, offset) -> written length or -errno
* *
* Invoked by IO#write or IO::Buffer#write to write +length+ bytes to +io+ from * Invoked by IO#write or IO::Buffer#write to write +length+ bytes to +io+ from

8
set.c
View file

@ -406,6 +406,13 @@ set_s_alloc(VALUE klass)
return set_alloc_with_size(klass, 0); return set_alloc_with_size(klass, 0);
} }
/*
* call-seq:
* Set[*objects] -> new_set
*
* Returns a new Set object populated with the given objects,
* See Set::new.
*/
static VALUE static VALUE
set_s_create(int argc, VALUE *argv, VALUE klass) set_s_create(int argc, VALUE *argv, VALUE klass)
{ {
@ -522,6 +529,7 @@ set_i_initialize(int argc, VALUE *argv, VALUE set)
return set; return set;
} }
/* :nodoc: */
static VALUE static VALUE
set_i_initialize_copy(VALUE set, VALUE other) set_i_initialize_copy(VALUE set, VALUE other)
{ {