def all @builded_classes.flat_map(&:all) end private def build_classes class_names.map do |class_name| Class.new(Grass).tap do |klass| Object.const_set class_name, klass end end end def class_names Dir.glob(File.join(ROOT, 'media', 'grass_*.png')).map do |f| File.basename(f, '.png').split("_").each {|s| s.capitalize! }.join("") end end end