Skip to content

Commit

Permalink
Extract named_helper module_eval so it's easier to override
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Nov 30, 2008
1 parent b546886 commit 8b10c3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions actionpack/lib/action_controller/routing/route_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ def define_named_route_methods(name, route)
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
Expand Down Expand Up @@ -166,7 +170,7 @@ def define_url_helper(route, name, kind, options)
#
# 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)}
Expand Down

0 comments on commit 8b10c3e

Please sign in to comment.