Class: Protobuf::Rpc::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/protobuf/rpc/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(mod) ⇒ Generator

Returns a new instance of Generator.



4
5
6
7
8
9
# File 'lib/protobuf/rpc/generator.rb', line 4

def initialize(mod)
  @mutex = Mutex.new
  @services = {}
  @clients = {}
  @module = mod
end

Instance Method Details

#generate(service, with: []) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/protobuf/rpc/generator.rb', line 11

def generate(service, with: [])
  @mutex.synchronize do
    define_service_class(service)
    with.each { |m| @services[service].define_rpc(m) }
    define_client_class(service)
  end
  self
end