Sha256: eb92103dcee97f115579bf100f39c71e68c4719f53a2bdab69a1ddbd8a0d464e

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

# Start me with : rackup rack.ru
# Default port is 9292

require 'sinatra/base'
require File::expand_path('../yamlade', File.dirname(__FILE__)) # When installed, just use : require 'yamlade'

class SinatrApp < Sinatra::Base
  set :app_file, __FILE__
  set :root, File.dirname(__FILE__)

  get '/?' do
    @conf = Yamlade.new("options.yml")
    @conf.to_form(request.path_info) + "<br /><br /><a href='/inspect'>&gt;&gt; INSPECT</a>"
  end
  
  post '/?' do
    @conf = Yamlade.new("options.yml")
    @conf.update(request['yaml'])
    @conf.to_form(request.path_info) + "<br /><br /><a href='/inspect'>&gt;&gt; INSPECT</a>"
  end
  
  get '/inspect' do
    YAML.load_file("options.yml").inspect
  end
  
end

run SinatrApp

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yamlade-0.0.2 examples/sinatra.ru
yamlade-0.0.1 examples/sinatra.ru