Class: ShamRack::HTTP
- Inherits:
-
Object
- Object
- ShamRack::HTTP
- Defined in:
- lib/sham_rack/http.rb
Overview
a sham version of Net::HTTP
Instance Attribute Summary collapse
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
-
#verify_mode ⇒ Object
Returns the value of attribute verify_mode.
Instance Method Summary collapse
-
#initialize(address, port, rack_app) ⇒ HTTP
constructor
A new instance of HTTP.
- #request(req, body = nil) {|response| ... } ⇒ Object
- #start {|_self| ... } ⇒ Object
Constructor Details
#initialize(address, port, rack_app) ⇒ HTTP
Returns a new instance of HTTP.
6 7 8 9 10 |
# File 'lib/sham_rack/http.rb', line 6 def initialize(address, port, rack_app) @address = address @port = port @rack_app = rack_app end |
Instance Attribute Details
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
16 17 18 |
# File 'lib/sham_rack/http.rb', line 16 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
16 17 18 |
# File 'lib/sham_rack/http.rb', line 16 def read_timeout @read_timeout end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
16 17 18 |
# File 'lib/sham_rack/http.rb', line 16 def use_ssl @use_ssl end |
#verify_mode ⇒ Object
Returns the value of attribute verify_mode.
16 17 18 |
# File 'lib/sham_rack/http.rb', line 16 def verify_mode @verify_mode end |
Instance Method Details
#request(req, body = nil) {|response| ... } ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sham_rack/http.rb', line 18 def request(req, body = nil) env = default_env env.merge!(path_env(req.path)) env.merge!(method_env(req)) env.merge!(header_env(req)) env.merge!(io_env(req, body)) response = build_response(@rack_app.call(env)) yield response if block_given? return response end |
#start {|_self| ... } ⇒ Object
12 13 14 |
# File 'lib/sham_rack/http.rb', line 12 def start yield self end |