Sha256: 3b8f3e67e6e6e86894361a2e3e8392ad7719245afa03b1eee2c833638aad922a
Contents?: true
Size: 568 Bytes
Versions: 1
Compression:
Stored size: 568 Bytes
Contents
# frozen_string_literal: true require_relative "./rpc" module ProtoDsl # Service class class Service attr_reader :name, :rpcs def initialize(name) @name = name @rpcs = [] end def rpc(name, request_type, response_type, &block) rpc = Rpc.new(name, request_type, response_type) rpc.instance_eval(&block) if block_given? @rpcs << rpc end def to_proto output = "service #{@name} {\n" @rpcs.each do |rpc| output << rpc.to_proto end output << "}\n" output end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proto_dsl-0.1.0 | lib/proto_dsl/service.rb |