Class: TDiary::Application
- Inherits:
-
Object
- Object
- TDiary::Application
- Defined in:
- lib/tdiary/application.rb
Instance Method Summary collapse
- #assets_paths ⇒ Object
- #call(env) ⇒ Object
-
#initialize(base_dir = nil) ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize(base_dir = nil) ⇒ Application
Returns a new instance of Application.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tdiary/application.rb', line 9 def initialize( base_dir = nil ) index_path = self.index_path update_path = self.update_path assets_path = self.assets_path assets_paths = self.assets_paths base_dir ||= self.base_dir @app = ::Rack::Builder.app do use TDiary::Rack::ErrorHandler map base_dir do map '/' do use TDiary::Rack::HtmlAnchor use TDiary::Rack::Static, ["public"] use TDiary::Rack::ValidRequestPath map index_path do run TDiary::Dispatcher.index end end map update_path do use TDiary::Rack::Auth run TDiary::Dispatcher.update end map assets_path do run TDiary::Rack::Static.new(nil, assets_paths) end end end run_plugin_startup_procs end |
Instance Method Details
#assets_paths ⇒ Object
46 47 48 49 50 |
# File 'lib/tdiary/application.rb', line 46 def assets_paths TDiary::Extensions::constants.map {|extension| TDiary::Extensions::const_get( extension ).assets_path }.flatten.uniq end |
#call(env) ⇒ Object
42 43 44 |
# File 'lib/tdiary/application.rb', line 42 def call( env ) @app.call( env ) end |