Class: Rack::App::Endpoint
- Inherits:
-
Object
- Object
- Rack::App::Endpoint
- Extended by:
- Forwardable
- Defined in:
- lib/rack/app/endpoint.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #fork(differences_in_properties) ⇒ Object
-
#initialize(properties) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #properties ⇒ Object
- #rack_app? ⇒ Boolean
- #to_app ⇒ Object
Constructor Details
#initialize(properties) ⇒ Endpoint
Returns a new instance of Endpoint.
14 15 16 |
# File 'lib/rack/app/endpoint.rb', line 14 def initialize(properties) @config = Rack::App::Endpoint::Config.new(properties) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/rack/app/endpoint.rb', line 12 def config @config end |
Instance Method Details
#call(env) ⇒ Object
26 27 28 |
# File 'lib/rack/app/endpoint.rb', line 26 def call(env) to_app.call(env) end |
#fork(differences_in_properties) ⇒ Object
18 19 20 |
# File 'lib/rack/app/endpoint.rb', line 18 def fork(differences_in_properties) self.class.new(self.properties.merge(differences_in_properties)) end |
#properties ⇒ Object
22 23 24 |
# File 'lib/rack/app/endpoint.rb', line 22 def properties @config.to_hash end |
#rack_app? ⇒ Boolean
37 38 39 40 41 |
# File 'lib/rack/app/endpoint.rb', line 37 def rack_app? !!@config.app_class rescue false end |
#to_app ⇒ Object
30 31 32 33 34 35 |
# File 'lib/rack/app/endpoint.rb', line 30 def to_app # TODO: fix this to cache it, but to that you need to resolve the problem when middlewares added, # old endpoints are not refreshed by the middleware configs # router.reset must be checked self.class::Builder.new(@config).to_app end |