mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
add Kernel#open
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
module Kernel
|
||||
def open(file, *rest)
|
||||
raise ArgumentError unless file.is_a?(String)
|
||||
|
||||
if file[0] == "|"
|
||||
IO.popen(file[1..-1], *rest)
|
||||
else
|
||||
File.open(file, *rest)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user