Ruby Sinatra Wiki search/list pages folder

So i just finished the Sinatra wiki project and I would like to create a page that will list the the pages created with clickable links to each page(textfile) that exists within the pages folder of the project.

I followed the link in the teachers notes about it and it says about using this bit of code to do this

d ="testdir") d.each {|x| puts "Got #{x}" }

I kinda get how it works but I dont understand how this fits into the project or where exactly this should be going. Would it be in the main .rb file?

some help understanding and implementing this would be greatly appreciated