Programming Ruby 3.2 (5th Edition): B4.0 page 565, being managed

@noelrappin

page 565, third paragraph : strange sentence

None of these methods are dependent on the file name being managed actually existing in
the file system.

irb(main):156:0> File.basename("/aaa/bbb/ccc/code.rb")
=> "code.rb"
irb(main):157:0> File.dirname("/aaa/bbb/ccc/code.rb")
=> "/aaa/bbb/ccc"

So I understand that none of these methods are dependent on the existence of a real file.

+++++ In ref_io/filenames.rb there is twice the same line

File.dirname("/usr/pickaxe/ruby/code.rb", 2) # => "/usr/pickaxe"
File.dirname("/usr/pickaxe/ruby/code.rb", 2) # => "/usr/pickaxe"

How do you like:

All these file names are just doing string manipulation, they are not dependent on the file name being managed actually existing in the file system.

string manipulation is good, being managed + existing still sounds weird.

  1. not dependent on the file name being managed by the file system
  2. not dependent on the file name actually existing in the file system

Preference : 2, remove being managed.

Did you see

+++++ In ref_io/filenames.rb there is twice the same line

@noelrappin

Not sure if you have received the two replies above.

I have, thanks!