I'm new to Ruby and trying to learn it. I'm using the latest Ruby version (2.4.1) and the interactive Ruby Shell.
I've come across the
Dir.children("testdir") #=> ["config.h", "main.rb"]
undefined method `children' for Dir:Class
This seems to be some kind of documentation mess.
Dir.children method was introduced with Feature #11302 into Ruby and was comitted to trunk. However, it appears that the patch adding this method was not actually backported to Ruby 2.4 since
dir.c of Ruby 2.4.1 doesn't mention the method. It's not immediately clear why the documentation for this method turned up at http://ruby-doc.org/
In any case, it appears you are yet out of luck with this method. You can however use the following equivalent code with your released version:
Dir.entries('testdir') - [".", ".."]
It will return the exact same values as
Dir.children('testdir') would in Ruby HEAD.