Sha256: 8465f6b5845f45326db5c12df1dfcc02abe3bf1b2089ecf85210af507378c178
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# -*- coding: utf-8 -*- # Zobacz przykład: http://gist.github.com/38605 require 'rdiscount' require 'sinatra/base' require 'sinatra/rdiscount' require 'sinatra/url_for' require 'sinatra/static_assets' module WB class NoSQL < Sinatra::Base helpers Sinatra::UrlForHelper register Sinatra::StaticAssets # disable overriding public and views dirs set :app_file, __FILE__ set :static, true # the middleware stack can be used internally as well. I'm using it for # sessions, logging, and methodoverride. This lets us move stuff out of # Sinatra if it's better handled by a middleware component. set :logging, true # use Rack::CommonLogger helpers Sinatra::RDiscount # configure blocks: # configure :production do # end #before do # mime :sql, 'text/plain; charset="UTF-8"' # when served by Sinatra itself #end # helper methods def page_title @title || "" end # def title=(name)... does not work, bug? def title(name) @title = " | #{name}" end get '/' do rdiscount :main end get '/:section' do rdiscount :"#{params[:section]}" end error do e = request.env['sinatra.error'] Kernel.puts e.backtrace.join("\n") 'Application error' end # each Sinatra::Base subclass has its own private middleware stack: use Rack::Lint end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nosql-tutorial-0.1.1 | lib/nosql.rb |
nosql-tutorial-0.1.0 | lib/nosql.rb |