Class: Flame::Application
- Inherits:
-
Object
- Object
- Flame::Application
- Defined in:
- lib/flame/application.rb
Overview
Core class, like Framework::Application
Class Method Summary collapse
-
.config ⇒ Object
Framework configuration.
- .inherited(app) ⇒ Object
- .mount(ctrl, path = nil, &block) ⇒ Object
-
.router ⇒ Object
Router for routing.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Init function.
- #config ⇒ Object
- #router ⇒ Object
Class Method Details
.config ⇒ Object
Framework configuration
8 9 10 |
# File 'lib/flame/application.rb', line 8 def self.config @config ||= {} end |
.inherited(app) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/flame/application.rb', line 16 def self.inherited(app) root_dir = File.dirname(caller[0].split(':')[0]) app.config.merge!( root_dir: root_dir, public_dir: File.join(root_dir, 'public'), views_dir: File.join(root_dir, 'views') ) end |
.mount(ctrl, path = nil, &block) ⇒ Object
30 31 32 |
# File 'lib/flame/application.rb', line 30 def self.mount(ctrl, path = nil, &block) router.add_controller(ctrl, path, block) end |
Instance Method Details
#call(env) ⇒ Object
Init function
26 27 28 |
# File 'lib/flame/application.rb', line 26 def call(env) Dispatcher.new(self, env).run! end |
#config ⇒ Object
12 13 14 |
# File 'lib/flame/application.rb', line 12 def config self.class.config end |
#router ⇒ Object
39 40 41 |
# File 'lib/flame/application.rb', line 39 def router self.class.router end |