mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
7b9d1da3fc
Added complete call-seq documentation for the entire mruby-io gem across both Ruby and C implementations: ## Ruby Methods (mrblib/) - 50 methods documented: ### Kernel Module (kernel.rb): - Backtick operator: shell command execution with output capture - open: unified file/subprocess opening with pipe support - p: debug output with inspect formatting and multiple argument handling - print/puts/printf: output methods with proper formatting and separators - gets/readline/readlines: input methods with various line handling options ### File Constants (file_constants.rb): - FNM_* constants: file name matching flags for glob and fnmatch operations with detailed explanations of case sensitivity, escaping, and pattern behavior ### IO Class (io.rb): Class methods: - IO.open: creates IO objects with automatic resource management - IO.popen: subprocess communication with pipe handling - IO.pipe: creates connected pipe endpoints for IPC - IO.read: convenience method for reading entire files Instance methods: - Stream positioning: pos=, rewind, tell with proper seeking behavior - Iteration: each, each_byte, each_char with enumerator support - Output: puts, print, printf with formatting and newline handling - Utility: hash, <<, ungetbyte with proper stream manipulation - Global streams: STDIN/STDOUT/STDERR and $stdin/$stdout/$stderr ### File Class (file.rb): Instance methods: - Constructor: handles both file paths and file descriptors - Timestamps: atime, ctime, mtime with proper Time object conversion - Inspection: inspect method for debugging file objects Class methods: - Path utilities: join with cross-platform separator handling - File iteration: foreach with block and enumerator support - FileTest delegation: complete set of file type and existence checks (directory?, exist?, file?, pipe?, size, socket?, symlink?, zero?) - Path manipulation: extname for extension extraction, path for conversion ## C Methods (src/) - 25 methods documented: ### Core IO Operations (io.c): - File descriptor management: fileno with proper error handling - Stream state: closed?, eof?, sync/sync= for buffering control - Process management: pid for pipe process tracking - Resource management: close_on_exec?/close_on_exec= for FD_CLOEXEC handling ### Reading Operations: - Character reading: getc, readchar with EOF handling differences - Byte reading: getbyte, readbyte with integer conversion - Buffer reading: read with length and output buffer support - Stream manipulation: ungetc for character pushback ### System Operations: - IO multiplexing: IO.select for monitoring multiple streams - Constructor: IO.new for creating IO objects from file descriptors - Stream flushing: flush for forcing output to OS Co-authored-by: Atlassian Rovo Dev