Class: Rubyists::Leopard::NatsServiceDiscovery::Operation::Verb
- Inherits:
-
Trailblazer::Operation
- Object
- Trailblazer::Operation
- Rubyists::Leopard::NatsServiceDiscovery::Operation::Verb
- Defined in:
- lib/leopard/nats_service_discovery/operation/verb.rb
Overview
Base class for $SRV.<VERB> operations.
Subclasses choose which Service API verb to invoke.
Instance Method Summary collapse
-
#collect(ctx) ⇒ Boolean
Collects responses for the subclass Service API verb.
-
#public_send_verb(_discovery) ⇒ Object
private
Invokes the subclass-specific discovery method.
Instance Method Details
#collect(ctx) ⇒ Boolean
Collects responses for the subclass Service API verb.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/leopard/nats_service_discovery/operation/verb.rb', line 21 def collect(ctx, **) discovery = NatsServiceDiscovery.new(client: ctx[:client], prefix: ctx[:prefix] || DEFAULT_PREFIX) ctx[:responses] = public_send_verb( discovery, name: ctx[:name], id: ctx[:id], timeout: ctx[:timeout] || DEFAULT_TIMEOUT, ) rescue StandardError => e ctx[:error] = e false end |
#public_send_verb(_discovery) ⇒ Object (private)
Invokes the subclass-specific discovery method.
39 40 41 |
# File 'lib/leopard/nats_service_discovery/operation/verb.rb', line 39 def public_send_verb(_discovery, **) raise NotImplementedError, "#{self.class} must define #public_send_verb" end |