Class: ProtoPharm::OperationStub
- Inherits:
-
Object
- Object
- ProtoPharm::OperationStub
- Defined in:
- lib/proto_pharm/operation_stub.rb
Instance Attribute Summary collapse
-
#deadline ⇒ Object
readonly
Returns the value of attribute deadline.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#response_proc ⇒ Object
readonly
Returns the value of attribute response_proc.
-
#trailing_metadata ⇒ Object
readonly
Returns the value of attribute trailing_metadata.
Instance Method Summary collapse
-
#cancelled? ⇒ Boolean
TODO: support stubbing.
-
#initialize(metadata: nil, deadline: nil, &response_proc) ⇒ OperationStub
constructor
A new instance of OperationStub.
-
#response ⇒ Object
(also: #execute)
Calls the block given upon instantiation and returns the result.
Constructor Details
#initialize(metadata: nil, deadline: nil, &response_proc) ⇒ OperationStub
Returns a new instance of OperationStub.
10 11 12 13 14 15 16 17 |
# File 'lib/proto_pharm/operation_stub.rb', line 10 def initialize(metadata: nil, deadline: nil, &response_proc) @response_proc = response_proc @metadata = @deadline = deadline # TODO: support stubbing @trailing_metadata = {} end |
Instance Attribute Details
#deadline ⇒ Object (readonly)
Returns the value of attribute deadline.
5 6 7 |
# File 'lib/proto_pharm/operation_stub.rb', line 5 def deadline @deadline end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/proto_pharm/operation_stub.rb', line 5 def @metadata end |
#response_proc ⇒ Object (readonly)
Returns the value of attribute response_proc.
5 6 7 |
# File 'lib/proto_pharm/operation_stub.rb', line 5 def response_proc @response_proc end |
#trailing_metadata ⇒ Object (readonly)
Returns the value of attribute trailing_metadata.
5 6 7 |
# File 'lib/proto_pharm/operation_stub.rb', line 5 def @trailing_metadata end |
Instance Method Details
#cancelled? ⇒ Boolean
TODO: support stubbing
26 27 28 |
# File 'lib/proto_pharm/operation_stub.rb', line 26 def cancelled? false end |
#response ⇒ Object Also known as: execute
Calls the block given upon instantiation and returns the result
20 21 22 |
# File 'lib/proto_pharm/operation_stub.rb', line 20 def response response_proc.call end |