Sha256: 2d53327677c94a164117d352ca9756369704af43373b184ae05672f2f4f37025
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
require 'sinatra/base' require 'haml' require 'woyo/world' module Woyo class Server < Sinatra::Application def self.load_world world = Woyo::World.new Dir['world/*.rb'].each do |filename| world.instance_eval File.read filename end world end configure do enable :sessions set root: '.' set world: self.load_world end def world settings.world end get '/' do redirect to '/default.html' if world.locations.empty? @location ||= world.locations[:home] || world.locations.values.first session[:location] = @location haml :location end get '/go/*' do |way| @location = session[:location].ways[way.to_sym].to session[:location] = @location haml :location end get '/do/*/*?/*?' do |item,action,tool| # do default or optional action on required item with optional tool end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
woyo-server-0.0.1 | lib/woyo/server/server.rb |