Building tile games or simulations in Ruby Gosu always makes me end upp with a list of all available tiles, saved by their class. For example [Pipe, PipeJunktion, Box, Pump]
and so on. Each class is defined in one of a few separate files, which i required from the main program. For now i have to add the class myself to this list every time I add a new tile to the game. I was wondering if there was a way to catch all loading classes from a file.
Something along the lines of:
allTiles = []
require_relative 'tiles.rb'.each_class {|class| allTiles << class}
would be handy. Or can this be solved with modules in some way?