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/user2+
puts File.basename("/path/to/file") # file3+
puts "".empty? # true4+
puts "hi".empty? # false5+
puts 5.clamp(1, 10) # 56+
puts 15.clamp(1, 10) # 107+
puts "hello".to_sym # hello8+
puts "a".ord # 979+
puts "42".to_i + 1 # 4310+
puts "done"src/codegen.cmodifiedView file
Loading diff…