Commit 4e43b6ae

4e43b6aeecd7Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 2 files · +1 added · ~1 modified

Description

Add 20 small methods for real-world program support

File: join, expand_path, basename, dirname, rename, size, mtime, ctime/stat, readlink. Dir: glob. String: empty?, to_i, ord, to_sym, each_line. Integer: clamp. Array/StrArray: each_with_index, any?, find, filter_map, max_by. StrArray: each, join, [], first, last, empty?.

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
4e43b6aeecd7
Parent
e0d0de21c3cc

examples/bm_fileops.rbaddedView file

1+puts File.join("home", "user") # home/user
2+puts File.basename("/path/to/file") # file
3+puts "".empty? # true
4+puts "hi".empty? # false
5+puts 5.clamp(1, 10) # 5
6+puts 15.clamp(1, 10) # 10
7+puts "hello".to_sym # hello
8+puts "a".ord # 97
9+puts "42".to_i + 1 # 43
10+puts "done"