Class: Plum::Rack::Session
- Inherits:
-
Object
- Object
- Plum::Rack::Session
- Defined in:
- lib/plum/rack/session.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#plum ⇒ Object
readonly
Returns the value of attribute plum.
Instance Method Summary collapse
-
#initialize(svc, sock, plum) ⇒ Session
constructor
A new instance of Session.
- #run ⇒ Object
- #stop ⇒ Object
- #to_io ⇒ Object
Constructor Details
#initialize(svc, sock, plum) ⇒ Session
Returns a new instance of Session.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/plum/rack/session.rb', line 11 def initialize(svc, sock, plum) @svc = svc @app = svc.app @sock = sock @plum = plum @logger = svc.logger @config = svc.config @remote_addr = sock.peeraddr.last @threadpool = svc.threadpool setup_plum rescue Errno::ENOTCONN # TCP connection reset while doing TLS handshake end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
9 10 11 |
# File 'lib/plum/rack/session.rb', line 9 def app @app end |
#plum ⇒ Object (readonly)
Returns the value of attribute plum.
9 10 11 |
# File 'lib/plum/rack/session.rb', line 9 def plum @plum end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/plum/rack/session.rb', line 34 def run while !@sock.closed? && !@sock.eof? @plum << @sock.readpartial(1024) end ensure stop end |
#stop ⇒ Object
26 27 28 |
# File 'lib/plum/rack/session.rb', line 26 def stop @plum.close end |
#to_io ⇒ Object
30 31 32 |
# File 'lib/plum/rack/session.rb', line 30 def to_io @sock.to_io end |