Sha256: 09339dea954213e6d77481e5914ad00bba29695f6b9d6623d0490a9495f8be07
Contents?: true
Size: 781 Bytes
Versions: 3
Compression:
Stored size: 781 Bytes
Contents
require 'roda' require 'json' module Pears class Web < Roda plugin :render, views: "#{__FILE__}/../web/views" route do |r| r.root do r.redirect "#{request.path}index" end r.get "index" do @subjects = Pears.subjects render('index') end r.on "subjects" do r.is do r.redirect "#{request.path.delete_suffix('/subjects')}/index" end r.get String do |subject| @subjects = Pears.subjects @subject = Pears[subject.to_sym] render('show') end r.post String do |subject| @subjects = Pears.subjects @subject = Pears[subject.to_sym] @subject.reboot render('show') end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pears-0.3.5 | lib/pears/web.rb |
pears-0.3.4 | lib/pears/web.rb |
pears-0.3.2 | lib/pears/web.rb |