Class: Temporalio::Api::PayloadVisitor
- Inherits:
-
Object
- Object
- Temporalio::Api::PayloadVisitor
- Defined in:
- lib/temporalio/api/payload_visitor.rb
Overview
Note:
WARNING: This class is not considered stable for external use and may change as needed for internal reasons.
Visitor for payloads within the protobuf structure. This visitor is thread safe and can be used multiple times since it stores no mutable state.
Instance Method Summary collapse
-
#initialize(on_enter: nil, on_exit: nil, skip_search_attributes: false, traverse_any: false) {|value| ... } ⇒ PayloadVisitor
constructor
Create a new visitor, calling the block on every Common::V1::Payload or Google::Protobuf::RepeatedField<Payload> encountered.
-
#run(value) ⇒ Object
Visit the given protobuf message.
Constructor Details
#initialize(on_enter: nil, on_exit: nil, skip_search_attributes: false, traverse_any: false) {|value| ... } ⇒ PayloadVisitor
Create a new visitor, calling the block on every Common::V1::Payload or Google::Protobuf::RepeatedField<Payload> encountered.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/temporalio/api/payload_visitor.rb', line 28 def initialize( on_enter: nil, on_exit: nil, skip_search_attributes: false, traverse_any: false, &block ) raise ArgumentError, 'Block required' unless block_given? @on_enter = on_enter @on_exit = on_exit @skip_search_attributes = skip_search_attributes @traverse_any = traverse_any @block = block end |
Instance Method Details
#run(value) ⇒ Object
Visit the given protobuf message.
46 47 48 49 50 51 |
# File 'lib/temporalio/api/payload_visitor.rb', line 46 def run(value) return unless value.is_a?(Google::Protobuf::MessageExts) method_name = method_name_from_proto_name(value.class.descriptor.name) send(method_name, value) if respond_to?(method_name, true) nil end |