From e2c4e2f4a7e86538240fb571beb28a7250e463c0 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 19 Jul 2025 11:06:58 +0900 Subject: [PATCH] mruby-errno: add comprehensive call-seq documentation for errno handling Added complete call-seq documentation for all errno module methods in mrblib/errno.rb (3 methods): ## Errno Module Methods: - const_defined?: checks if errno constant exists on the system, provides dynamic errno constant detection by querying both system-defined errno values and superclass constants with proper boolean return values - const_missing: handles dynamic errno constant definition when undefined constants are referenced, automatically defines errno classes for valid system error codes and delegates to superclass for invalid names - constants: returns array of all available errno constant names on the system, includes both already defined constants and those that can be dynamically defined, with dependency note for mruby-metaprog gem Co-authored-by: Atlassian Rovo Dev --- mrbgems/mruby-errno/mrblib/errno.rb | 39 +++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/mrbgems/mruby-errno/mrblib/errno.rb b/mrbgems/mruby-errno/mrblib/errno.rb index 52899396b..b85f705ee 100644 --- a/mrbgems/mruby-errno/mrblib/errno.rb +++ b/mrbgems/mruby-errno/mrblib/errno.rb @@ -1,14 +1,49 @@ module Errno + # + # call-seq: + # Errno.const_defined?(name) -> true or false + # + # Returns true if the given name is defined as an errno constant, + # false otherwise. This method checks both system-defined errno + # constants and those defined by the superclass. + # + # Errno.const_defined?(:ENOENT) #=> true + # Errno.const_defined?(:EINVAL) #=> true + # Errno.const_defined?(:UNKNOWN) #=> false + # def Errno.const_defined?(name) __errno_defined?(name) or super end + # + # call-seq: + # Errno.const_missing(name) -> errno_class + # + # Called when an undefined constant is referenced. This method + # attempts to define the errno constant if it exists in the system, + # otherwise delegates to the superclass. + # + # Errno::ENOENT # triggers const_missing if not yet defined + # #=> Errno::ENOENT + # def Errno.const_missing(name) __errno_define(name) or super end - # Module#constants is defined in mruby-metaprog - # So, it may be raised NoMethodError + # + # call-seq: + # Errno.constants -> array + # + # Returns an array of all errno constant names available on the system. + # This includes both already defined constants and those that can be + # dynamically defined. + # + # Errno.constants + # #=> [:EPERM, :ENOENT, :ESRCH, :EINTR, :EIO, ...] + # + # Note: Module#constants is defined in mruby-metaprog, so this method + # may raise NoMethodError if that gem is not available. + # def Errno.constants __errno_list(super) end