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
25 lines
704 B
Ruby
25 lines
704 B
Ruby
class File
|
|
# File name matching constants used with File.fnmatch and Dir.glob
|
|
module Constants
|
|
# Makes File.fnmatch case sensitive on systems where it's case insensitive by default
|
|
FNM_SYSCASE = 0
|
|
|
|
# Disables the special meaning of the backslash escape character
|
|
FNM_NOESCAPE = 1
|
|
|
|
# Pathname wildcard doesn't match '/' (directory separator)
|
|
FNM_PATHNAME = 2
|
|
|
|
# Allows patterns to match hidden files (those starting with '.')
|
|
FNM_DOTMATCH = 4
|
|
|
|
# Makes the pattern case insensitive (overrides FNM_SYSCASE)
|
|
FNM_CASEFOLD = 8
|
|
end
|
|
end
|
|
|
|
class File
|
|
# Include Constants module to make FNM_* constants available directly on File class
|
|
include File::Constants
|
|
end
|