class RailsTwirp::RouteSet

Attributes

services[R]

Public Class Methods

new() click to toggle source
# File lib/rails_twirp/route_set.rb, line 11
def initialize
  # Make services a hash with a default_proc, so the same class gets reused if the service
  # method is used multiple times with the same key.
  # This makes it possible to split up the routes into multiple files.
  @services = Hash.new { |hash, key| hash[key] = ServiceRouteSet.new(key) }
end

Public Instance Methods

draw(&block) click to toggle source
# File lib/rails_twirp/route_set.rb, line 18
def draw(&block)
  mapper = Mapper.new(self)
  mapper.instance_exec(&block)
end
to_services() click to toggle source
# File lib/rails_twirp/route_set.rb, line 23
def to_services
  services.each_value.map(&:to_service)
end