45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# 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|
::Rails::RFC6570.build_url_template(self, route, **opts)
end
define_method(rfc6570_url_name) do |**opts|
::Rails::RFC6570.build_url_template(
self,
route,
**opts,
path_only: false,
)
end
define_method(rfc6570_path_name) do |**opts|
::Rails::RFC6570.build_url_template(
self,
route,
**opts,
path_only: true,
)
end
end
set << rfc6570_name
set << rfc6570_url_name
set << rfc6570_path_name
end
|