Sha256: 7214f47e4cba5c4e11781ed32c3f377a06c17eb68d448a7ea94eb101677d424e

Contents?: true

Size: 677 Bytes

Versions: 22

Compression:

Stored size: 677 Bytes

Contents

require 'protobuf/generators/base'

module Protobuf
  module Generators
    class ServiceGenerator < Base

      def compile
        run_once(:compile) do
          print_class(descriptor.name, :service) do
            descriptor.method.each do |method_descriptor|
              puts build_method(method_descriptor)
            end
          end
        end
      end

      def build_method(method_descriptor)
        name = method_descriptor.name
        request_klass = modulize(method_descriptor.input_type)
        response_klass = modulize(method_descriptor.output_type)
        "rpc :#{name.underscore}, #{request_klass}, #{response_klass}"
      end

    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
protobuf-3.6.12 lib/protobuf/generators/service_generator.rb
protobuf-3.6.11 lib/protobuf/generators/service_generator.rb
protobuf-3.6.10 lib/protobuf/generators/service_generator.rb
protobuf-3.6.9 lib/protobuf/generators/service_generator.rb
protobuf-3.6.7 lib/protobuf/generators/service_generator.rb
protobuf-3.6.6 lib/protobuf/generators/service_generator.rb
protobuf-3.6.2 lib/protobuf/generators/service_generator.rb
protobuf-3.6.1 lib/protobuf/generators/service_generator.rb
protobuf-3.6.0 lib/protobuf/generators/service_generator.rb
protobuf-3.5.5 lib/protobuf/generators/service_generator.rb
protobuf-3.5.4 lib/protobuf/generators/service_generator.rb
protobuf-3.5.3 lib/protobuf/generators/service_generator.rb
protobuf-3.5.2 lib/protobuf/generators/service_generator.rb
protobuf-3.5.1 lib/protobuf/generators/service_generator.rb
prepor-protobuf-3.5.1 lib/protobuf/generators/service_generator.rb
prepor-protobuf-3.5.0 lib/protobuf/generators/service_generator.rb
protobuf-3.5.0 lib/protobuf/generators/service_generator.rb
protobuf-3.4.4 lib/protobuf/generators/service_generator.rb
protobuf-3.4.3 lib/protobuf/generators/service_generator.rb
protobuf-3.4.2 lib/protobuf/generators/service_generator.rb