Class: Flame::Application
- Inherits:
-
Object
- Object
- Flame::Application
- Defined in:
- lib/flame/application.rb,
lib/flame/application/config.rb
Overview
Core class, like Framework::Application
Defined Under Namespace
Classes: Config
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
- .cached_tilts ⇒ Object
-
.call(env) ⇒ Object
Make available ‘run Application` without `.new` for `rackup`.
-
.inherited(app) ⇒ Object
Generating application config when inherited.
-
.router ⇒ Object
Router for routing.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Request recieving method.
-
#config ⇒ Object
Framework configuration.
-
#initialize(app = nil) ⇒ Application
constructor
A new instance of Application.
- #router ⇒ Object
Constructor Details
#initialize(app = nil) ⇒ Application
Returns a new instance of Application.
79 80 81 |
# File 'lib/flame/application.rb', line 79 def initialize(app = nil) @app = app end |
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/flame/application.rb', line 11 def config @config end |
Class Method Details
.cached_tilts ⇒ Object
18 19 20 |
# File 'lib/flame/application.rb', line 18 def cached_tilts @cached_tilts ||= {} end |
.call(env) ⇒ Object
Make available ‘run Application` without `.new` for `rackup`
35 36 37 38 |
# File 'lib/flame/application.rb', line 35 def call(env) @app ||= new @app.call env end |
.inherited(app) ⇒ Object
Generating application config when inherited
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/flame/application.rb', line 23 def inherited(app) app.config = Config.new( app, default_config_dirs( root_dir: File.dirname(caller[0].split(':')[0]) ).merge( environment: ENV['RACK_ENV'] || 'development' ) ) end |
Instance Method Details
#call(env) ⇒ Object
Request recieving method
84 85 86 87 |
# File 'lib/flame/application.rb', line 84 def call(env) @app.call(env) if @app.respond_to? :call Flame::Dispatcher.new(self, env).run! end |
#config ⇒ Object
Framework configuration
71 72 73 |
# File 'lib/flame/application.rb', line 71 def config self.class.config end |
#router ⇒ Object
75 76 77 |
# File 'lib/flame/application.rb', line 75 def router self.class.router end |