From d1fc8c7f58898cdc0670ebd08d9d65a9c4327b54 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Tue, 9 Dec 2014 12:50:52 +0100 Subject: [PATCH] List only YAML files --- nikoli.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nikoli.rb b/nikoli.rb index 751b947..1aa073c 100755 --- a/nikoli.rb +++ b/nikoli.rb @@ -27,7 +27,8 @@ get "/data/:game.json" do |game| data_file = Pathname.new(File.join(settings.data_folder, game)) halt(404) unless data_file.directory? - json data_file.children(false).map { |path| path.to_s.sub(/.yml$/, '') } + json data_file.children(false).select { |path| path.to_s.end_with?('.yml') } + .map { |path| path.to_s.sub(/.yml$/, '') } end get "/data/:game/:file.json" do |game, file|