Ruby 2.4.1 Dir.children( dirname ) returns "undefined method `children' for Dir:Class"

Viewed 1281

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 children method in the Dir class. I've tried the example from the documentation:

Dir.children("testdir")   #=> ["config.h", "main.rb"]

but it doesn't seem to work, because I get the following message:

undefined method `children' for Dir:Class

What am I missing?

1 Answers
Related