Use Sinatra modular application
parent
0d1dc82a7e
commit
4c6ba9c89e
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'sinatra'
|
||||
require 'sinatra/base'
|
||||
require 'sinatra/content_for'
|
||||
require 'sinatra/json'
|
||||
|
||||
|
@ -9,6 +9,7 @@ require 'coffee-script'
|
|||
require 'slim'
|
||||
require 'sass'
|
||||
|
||||
class Nikoli < Sinatra::Application
|
||||
GAMES = %i{akari hitori nurikabe sudoku}
|
||||
|
||||
set :data_folder, File.expand_path('./data')
|
||||
|
@ -38,3 +39,6 @@ get "/data/:game/:file.json" do |game, file|
|
|||
data = YAML.load_file(data_file)['data']
|
||||
json Array(data).sample
|
||||
end
|
||||
|
||||
run! if app_file == $0
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue