Sha256: 0ced75a2b3b4a0a40f2b3f3f22511c68cc95ccee0af8ea174472992da0aa4db9

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

module ProtoPharm
  module Introspection
    module ServiceResolver
      class InvalidGRPCServiceError < StandardError; end

      class << self
        def resolve(service)
          raise InvalidGRPCServiceError, "Not a valid gRPC service module: #{service.inspect}" unless service.respond_to?(:const_defined?)

          service.const_defined?(:Service) ? service::Service : service
        end
      end

      # We'll need this later
      # attr_reader :service

      # def initialize(service)
      #   @service = service
      # end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proto_pharm-0.7.0 lib/proto_pharm/introspection/service_resolver.rb
proto_pharm-0.6.0 lib/proto_pharm/introspection/service_resolver.rb