Sha256: a906d57c8bb30bc1e2278a20fbfaf98f284cf479e3a6d57946e3c0c04d91e8b1

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

require 'sinatra/base'
require 'haml'
require 'woyo/world'

module Woyo

class Server < Sinatra::Application

  configure do
    set root: '.'
    enable :sessions
  end

  def world
    raise 'No world provided' unless settings.respond_to? :world
    settings.world
  end

  get '/' do
    @location = world.location :home
    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.pre2 lib/woyo/server/server.rb