Module: Rails::RFC6570::Helper

Defined in:
lib/rails/rfc6570.rb

Instance Method Summary collapse

Instance Method Details

#rfc6570_route(name, **opts) ⇒ Object



109
110
111
112
113
114
# File 'lib/rails/rfc6570.rb', line 109

def rfc6570_route(name, **opts)
  route = Rails.application.routes.named_routes[name]
  raise KeyError.new "No named routed for `#{name}'." unless route

  route.to_rfc6570(**opts, ctx: self)
end

#rfc6570_routes(**opts) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/rails/rfc6570.rb', line 100

def rfc6570_routes(**opts)
  routes = {}
  Rails.application.routes.named_routes.names.each do |key|
    routes[key] = rfc6570_route(key, **opts)
  end

  routes
end