File Directory Ruby

d = Dir.open('mydir')
d.reject { |f| f[0] == '.' }
d.entries.size                                      # => 0
d.rewind
d.entries.size                                      # => 6
d.close