Class: Kawaii::Base
- Inherits:
-
Object
- Object
- Kawaii::Base
- Extended by:
- RoutingMethods, ServerMethods
- Defined in:
- lib/kawaii/base.rb
Overview
Base class for all Kawaii applications. Inherit from this class to create a modular application.
Direct Known Subclasses
Constant Summary
Constants included from ServerMethods
Class Method Summary (collapse)
-
+ (Object) call(env)
Make it runnable via `run MyApp`.
Instance Method Summary (collapse)
-
- (Object) call(env)
Instances of classes derived from [Kawaii::Base] are Rack applications.
-
- (Base) initialize(downstream_app = nil)
constructor
A new instance of Base.
Methods included from RoutingMethods
add_http_method, context, delete, get, head, link, match, methods_used, options, patch, post, put, route, trace, unlink
Methods included from ServerMethods
Constructor Details
- (Base) initialize(downstream_app = nil)
Returns a new instance of Base
17 18 19 |
# File 'lib/kawaii/base.rb', line 17 def initialize(downstream_app = nil) @downstream_app = downstream_app end |
Class Method Details
+ (Object) call(env)
Make it runnable via `run MyApp`.
32 33 34 35 |
# File 'lib/kawaii/base.rb', line 32 def call(env) @app ||= new @app.call(env) end |
Instance Method Details
- (Object) call(env)
Instances of classes derived from [Kawaii::Base] are Rack applications.
22 23 24 25 |
# File 'lib/kawaii/base.rb', line 22 def call(env) matching = self.class.match(env) || not_found matching.call(env) end |