class ProtoPharm::OperationStub

Attributes

deadline[R]
metadata[R]
response_proc[R]
trailing_metadata[R]

Public Class Methods

new(metadata: nil, deadline: nil, &response_proc) click to toggle source

@param metadata [Hash] Any metadata passed into the GRPC request @param deadline [Time] The deadline set on the GRPC request @yieldreturn [*] The stubbed value or error expected to be returned from the request

# File lib/proto_pharm/operation_stub.rb, line 10
def initialize(metadata: nil, deadline: nil, &response_proc)
  @response_proc = response_proc
  @metadata = metadata
  @deadline = deadline

  # TODO: support stubbing
  @trailing_metadata = {}
end

Public Instance Methods

cancelled?() click to toggle source

TODO: support stubbing

# File lib/proto_pharm/operation_stub.rb, line 26
def cancelled?
  false
end
execute()
Alias for: response
response() click to toggle source

Calls the block given upon instantiation and returns the result

# File lib/proto_pharm/operation_stub.rb, line 20
def response
  response_proc.call
end
Also aliased as: execute