As I have checked in the Ruby debugger, the following code works correctly for both the real directories and symlinks:
Dir["#{parent_path}/*/plugin.rb"].sort.each do |path|