Class: Hanami::Application
- Inherits:
-
Object
- Object
- Hanami::Application
- Defined in:
- lib/hanami/application.rb
Overview
A full stack Hanami application
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.inherited(base) ⇒ Object
private
Override Ruby’s Class#inherited.
Instance Method Summary collapse
-
#call(env) ⇒ Array
Process a request.
-
#initialize ⇒ Hanami::Application
constructor
Initialize and load a new instance of the application.
Constructor Details
#initialize ⇒ Hanami::Application
Initialize and load a new instance of the application
162 163 164 165 |
# File 'lib/hanami/application.rb', line 162 def initialize @renderer = RenderingPolicy.new(configuration) @middleware = configuration.middleware end |
Class Method Details
.inherited(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override Ruby’s Class#inherited
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/hanami/application.rb', line 28 def self.inherited(base) super base.extend(ClassMethods) base.namespace.module_eval do class << self # Logger for this application # # @return [Hanami::Logger] the logger for this Hanami application # # @since 0.9.0 # @api public # # @example # # Web.logger # Admin.logger attr_accessor :logger # Routes for this application # # @return [Hanami::Routes] the routes for this Hanami application # # @since 0.9.0 # @api public # # @example # # Web.routes # Admin.routes attr_accessor :routes end end end |
Instance Method Details
#call(env) ⇒ Array
Process a request. This method makes Hanami applications compatible with the Rack protocol.
179 180 181 |
# File 'lib/hanami/application.rb', line 179 def call(env) renderer.render(env, middleware.call(env)) end |