mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Extract named_helper module_eval so it's easier to override
This commit is contained in:
parent
9e4621d6f7
commit
635e2ccd3e
1 changed files with 6 additions and 2 deletions
|
@ -138,9 +138,13 @@ module ActionController
|
|||
end
|
||||
end
|
||||
|
||||
def named_helper_module_eval(code, *args)
|
||||
@module.module_eval(code, *args)
|
||||
end
|
||||
|
||||
def define_hash_access(route, name, kind, options)
|
||||
selector = hash_access_name(name, kind)
|
||||
@module.module_eval <<-end_eval # We use module_eval to avoid leaks
|
||||
named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks
|
||||
def #{selector}(options = nil)
|
||||
options ? #{options.inspect}.merge(options) : #{options.inspect}
|
||||
end
|
||||
|
@ -168,7 +172,7 @@ module ActionController
|
|||
#
|
||||
# foo_url(bar, baz, bang, :sort_by => 'baz')
|
||||
#
|
||||
@module.module_eval <<-end_eval # We use module_eval to avoid leaks
|
||||
named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks
|
||||
def #{selector}(*args)
|
||||
|
||||
#{generate_optimisation_block(route, kind)}
|
||||
|
|
Loading…
Reference in a new issue