Module: ActionDispatch::Routing::Mapper::Twirp

Defined in:
lib/action_dispatch/routing/mapper/twirp.rb

Overview

Define mapping a generated twirp class and your controller

Instance Method Summary collapse

Instance Method Details

#twirp(service_class, controller:) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/action_dispatch/routing/mapper/twirp.rb', line 8

def twirp(service_class, controller:)
  service_class.rpcs.each do |_, rpcdef|
    path = [service_class.service_full_name, rpcdef[:rpc_method]].join('/')
    action = [controller, rpcdef[:ruby_method]].join('#')
    match path, to: action, via: :post
  end
end