Use methods in the File class to manipulate FILE
Inside test.rb, I have
puts __FILE__
puts File.dirname(__FILE__)
puts File.basename(__FILE__)
When you run,
ruby a/b/test.rb
You get
a/b/test.rb
a/b
test.rb
Use methods in the File class to manipulate FILE
Inside test.rb, I have
puts __FILE__
puts File.dirname(__FILE__)
puts File.basename(__FILE__)
When you run,
ruby a/b/test.rb
You get
a/b/test.rb
a/b
test.rb