Class: Yrpc::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/yrpc/controllers/response.rb

Defined Under Namespace

Modules: Code

Instance Method Summary collapse

Constructor Details

#initialize(operation, execution_time = nil) ⇒ Response

Returns a new instance of Response.



84
85
86
87
88
89
90
91
92
# File 'lib/yrpc/controllers/response.rb', line 84

def initialize(operation, execution_time = nil)
  @operation = operation
  @message = operation.execute
  @metadata = operation.
  @trailing_metadata = operation.
  @deadline = operation.deadline
  @cancelled = operation.cancelled?
  @execution_time = execution_time || 0.0
end

Instance Method Details

#messageObject



94
95
96
# File 'lib/yrpc/controllers/response.rb', line 94

def message
  @message ||= @operation.execute
end

#statusObject



98
99
100
101
# File 'lib/yrpc/controllers/response.rb', line 98

def status
  @message ||= @operation.execute
  @message&.status
end