module Rails::RFC6570::Extensions::NamedRouteCollection
Public Instance Methods
Source
# File lib/rails/rfc6570.rb, line 73 def add(name, route) super define_rfc6570_helpers name, route, @url_helpers_module, @url_helpers end
Calls superclass method
Also aliased as: []=
Source
# File lib/rails/rfc6570.rb, line 45 def define_rfc6570_helpers(name, route, mod, set) rfc6570_name = :"#{name}_rfc6570" rfc6570_url_name = :"#{name}_url_rfc6570" rfc6570_path_name = :"#{name}_path_rfc6570" [rfc6570_name, rfc6570_url_name, rfc6570_path_name].each do |helper| mod.send :undef_method, helper if mod.respond_to? helper end mod.module_eval do define_method(rfc6570_name) do |**opts| route.to_rfc6570(**opts, ctx: self) end define_method(rfc6570_url_name) do |**opts| route.to_rfc6570(**opts, ctx: self, path_only: false) end define_method(rfc6570_path_name) do |**opts| route.to_rfc6570(**opts, ctx: self, path_only: true) end end set << rfc6570_name set << rfc6570_url_name set << rfc6570_path_name end
Source
# File lib/rails/rfc6570.rb, line 41 def to_rfc6570(**opts) routes.to_h {|name, route| [name, route.to_rfc6570(**opts)] } end