lib/datamapper-tutorial.rb in wbzyl-datamapper-tutorial-0.0.8 vs lib/datamapper-tutorial.rb in wbzyl-datamapper-tutorial-0.0.9
- old
+ new
@@ -1,19 +1,28 @@
# -*- coding: utf-8 -*-
# Zobacz przykład: http://gist.github.com/38605
-gem 'rdiscount'
-gem 'sinatra'
-gem 'wbzyl-sinatra-rdiscount'
+#gem 'rdiscount'
+#gem 'sinatra'
+#gem 'wbzyl-sinatra-rdiscount'
+#gem 'emk-sinatra-url-for'
+#gem 'wbzyl-sinatra-static-assets'
+
require 'rdiscount'
require 'sinatra/base'
require 'sinatra/rdiscount'
+require 'sinatra/url_for'
+require 'sinatra/static_assets'
+
module WB
class DatamapperTutorial < Sinatra::Base
+ helpers Sinatra::UrlForHelper
+ helpers 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
@@ -31,11 +40,18 @@
# mime :sql, 'text/plain; charset="UTF-8"' # when served by Sinatra itself
#end
# helper methods
- attr_accessor :title
+ def page_title
+ @title || ""
+ end
+
+ # def title=(name)... does not work, bug?
+ def title(name)
+ @title = " | #{name}"
+ end
get '/' do
rdiscount :main
end
@@ -51,6 +67,5 @@
# each Sinatra::Base subclass has its own private middleware stack:
use Rack::Lint
end
end
-