Class: RailsTwirp::ServiceMapper

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rails_twirp/mapper.rb

Defined Under Namespace

Classes: Mapping

Instance Method Summary collapse

Constructor Details

#initialize(service_route_set, mapper) ⇒ ServiceMapper

Returns a new instance of ServiceMapper.



45
46
47
48
# File 'lib/rails_twirp/mapper.rb', line 45

def initialize(service_route_set, mapper)
  @service_route_set = service_route_set
  @mapper = mapper
end

Instance Method Details

#rpc(name, to:) ⇒ Object



50
51
52
53
# File 'lib/rails_twirp/mapper.rb', line 50

def rpc(name, to:)
  mapping = Mapping.new(to: to, module: @mapper.send(:_module))
  @service_route_set.add_route(name, mapping)
end