This commit is contained in:
Ryan McGrath 2016-04-19 17:21:03 +09:00
commit 3ccef121b8
No known key found for this signature in database
GPG key ID: 811674B62B666830
7 changed files with 50 additions and 0 deletions

20
app.rb Normal file
View file

@ -0,0 +1,20 @@
require 'sinatra'
require 'tilt/erb'
set :public_folder, 'public'
class CorgBotApp < Sinatra::Base
get '/' do
extensions = ['.png', '.jpg', '.jpeg', '.gif']
images = Dir.entries('public/images').delete_if { |x|
extension = x[-4, 4]
!extensions.index(extension)
}
corgi = images[rand(images.length)]
erb :index, :locals => {
:corgi => corgi
}
end
end