Module: Twirbet::DSL::ClassMethods

Extended by:
T::Helpers, T::Sig
Defined in:
lib/twirbet/dsl.rb

Instance Method Summary collapse

Instance Method Details

#full_nameObject



42
43
44
45
46
47
48
# File 'lib/twirbet/dsl.rb', line 42

def full_name
  if package_name.nil?
    service_name
  else
    "#{package_name}.#{service_name}"
  end
end

#package(name) ⇒ Object



20
21
22
# File 'lib/twirbet/dsl.rb', line 20

def package(name)
  @package = name
end

#package_nameObject



25
26
27
# File 'lib/twirbet/dsl.rb', line 25

def package_name
  @package
end

#rpc(name, request, response, ruby_method:) ⇒ Object



51
52
53
54
# File 'lib/twirbet/dsl.rb', line 51

def rpc(name, request, response, ruby_method:)
  method = Method.new(name, request, response, ruby_method: ruby_method)
  rpcs[method.name] = method
end

#rpcsObject



57
58
59
# File 'lib/twirbet/dsl.rb', line 57

def rpcs
  @rpcs ||= {}
end

#service(name) ⇒ Object



30
31
32
# File 'lib/twirbet/dsl.rb', line 30

def service(name)
  @service = name
end

#service_nameObject



35
36
37
38
39
# File 'lib/twirbet/dsl.rb', line 35

def service_name
  raise "Unknown service name. Did you forget to call `service`?" if @service.nil?

  @service
end