Module: AnyCable::WithConnectionState
- Included in:
- CommandMessage, CommandResponse, ConnectionResponse, DisconnectRequest
- Defined in:
- lib/anycable/rpc.rb
Overview
Add setters/getter for cstate field
Instance Method Summary collapse
- #cstate ⇒ Object
- #cstate=(val) ⇒ Object
- #initialize(session: nil, **other) ⇒ Object
- #istate ⇒ Object
- #istate=(val) ⇒ Object
- #session ⇒ Object
- #session=(val) ⇒ Object
Instance Method Details
#cstate ⇒ Object
38 39 40 |
# File 'lib/anycable/rpc.rb', line 38 def cstate env.cstate end |
#cstate=(val) ⇒ Object
42 43 44 |
# File 'lib/anycable/rpc.rb', line 42 def cstate=(val) env.cstate = val end |
#initialize(session: nil, **other) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/anycable/rpc.rb', line 15 def initialize(session: nil, **other) if session other[:cstate] ||= {} other[:cstate][SESSION_KEY] = session end super(**other) end |
#istate ⇒ Object
46 47 48 |
# File 'lib/anycable/rpc.rb', line 46 def istate env.istate end |
#istate=(val) ⇒ Object
50 51 52 |
# File 'lib/anycable/rpc.rb', line 50 def istate=(val) env.istate = val end |
#session ⇒ Object
31 32 33 34 35 36 |
# File 'lib/anycable/rpc.rb', line 31 def session state_ = cstate if state_ state_[SESSION_KEY] end end |
#session=(val) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/anycable/rpc.rb', line 23 def session=(val) self.cstate = {} unless cstate state_ = cstate if state_ state_[SESSION_KEY] = val end end |