Sha256: de135384942849167c8744cd2569818e93d143ab606eddca2e90e352a4b0809e
Contents?: true
Size: 836 Bytes
Versions: 2
Compression:
Stored size: 836 Bytes
Contents
# frozen_string_literal: true module ProtoPharm class OperationStub attr_reader :response_proc, :metadata, :trailing_metadata, :deadline # @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 def initialize(metadata: nil, deadline: nil, &response_proc) @response_proc = response_proc @metadata = metadata @deadline = deadline # TODO: support stubbing @trailing_metadata = {} end # Calls the block given upon instantiation and returns the result def response response_proc.call end alias_method :execute, :response # TODO: support stubbing def cancelled? false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
proto_pharm-0.7.0 | lib/proto_pharm/operation_stub.rb |
proto_pharm-0.6.0 | lib/proto_pharm/operation_stub.rb |