Class: FaradayCage::Server
- Inherits:
-
Object
- Object
- FaradayCage::Server
- Defined in:
- lib/faraday_cage/server.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(app = FaradayCage.app) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(app = FaradayCage.app) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 20 |
# File 'lib/faraday_cage/server.rb', line 12 def initialize(app = FaradayCage.app) if app @app = app else raise Error, 'No Rack app configured. Please see documentation for details.' end @middleware = RackMiddleware.new(app) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/faraday_cage/server.rb', line 10 def app @app end |
Instance Method Details
#connection ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/faraday_cage/server.rb', line 22 def connection @connection ||= Faraday.new(FaradayCage.default_host) do |conn| if FaradayCage.middleware.respond_to?(:call) FaradayCage.middleware.call(conn) end conn.adapter :rack, app end end |