Class: GrpcKit::Session::StreamStatus
- Inherits:
-
Object
- Object
- GrpcKit::Session::StreamStatus
- Defined in:
- lib/grpc_kit/session/stream_status.rb
Constant Summary collapse
- OPEN =
0
- CLOSE =
1
- HALF_CLOSE_REMOTE =
2
- HALF_CLOSE_LOCAL =
3
Instance Method Summary collapse
- #close ⇒ void
- #close? ⇒ Boolean
- #close_local ⇒ void
- #close_local? ⇒ Boolean
- #close_remote ⇒ void
- #close_remote? ⇒ Boolean
-
#initialize ⇒ StreamStatus
constructor
A new instance of StreamStatus.
Constructor Details
#initialize ⇒ StreamStatus
Returns a new instance of StreamStatus.
11 12 13 |
# File 'lib/grpc_kit/session/stream_status.rb', line 11 def initialize @status = OPEN end |
Instance Method Details
#close ⇒ void
This method returns an undefined value.
42 43 44 |
# File 'lib/grpc_kit/session/stream_status.rb', line 42 def close @status = CLOSE end |
#close? ⇒ Boolean
57 58 59 |
# File 'lib/grpc_kit/session/stream_status.rb', line 57 def close? @status == CLOSE end |
#close_local ⇒ void
This method returns an undefined value.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/grpc_kit/session/stream_status.rb', line 16 def close_local if @status == OPEN @status = HALF_CLOSE_LOCAL elsif @status == HALF_CLOSE_REMOTE @status = CLOSE elsif @status == HALF_CLOSE_LOCAL # nothing else raise 'stream is already closed' end end |
#close_local? ⇒ Boolean
47 48 49 |
# File 'lib/grpc_kit/session/stream_status.rb', line 47 def close_local? (@status == HALF_CLOSE_LOCAL) || close? end |
#close_remote ⇒ void
This method returns an undefined value.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/grpc_kit/session/stream_status.rb', line 29 def close_remote if @status == OPEN @status = HALF_CLOSE_REMOTE elsif @status == HALF_CLOSE_LOCAL @status = CLOSE elsif @status == HALF_CLOSE_REMOTE # nothing else raise 'stream is already closed' end end |
#close_remote? ⇒ Boolean
52 53 54 |
# File 'lib/grpc_kit/session/stream_status.rb', line 52 def close_remote? (@status == HALF_CLOSE_REMOTE) || close? end |