Skip to content
Browse files

don't use instance eval, just reference variables so we don't have to

worry about "inspect" marshalling
  • Loading branch information...
1 parent 04d308a commit 0035c54e2f5b0d5b4d27d50d16fb91bad4060c5a @tenderlove tenderlove committed
Showing with 11 additions and 10 deletions.
  1. +11 −10 actionpack/lib/action_dispatch/routing/route_set.rb
View
21 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -149,22 +149,23 @@ def define_named_route_methods(name, route)
def define_hash_access(route, name, kind, options)
selector = hash_access_name(name, kind)
- # We use module_eval to avoid leaks
- @module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1
- remove_possible_method :#{selector}
- def #{selector}(*args)
- options = args.extract_options!
- result = #{options.inspect}
+ @module.module_eval do
+ remove_possible_method selector
+
+ define_method(selector) do |*args|
+ inner_options = args.extract_options!
+ result = options.dup
if args.any?
result[:_positional_args] = args
- result[:_positional_keys] = #{route.segment_keys.inspect}
+ result[:_positional_keys] = route.segment_keys
end
- result.merge(options)
+ result.merge(inner_options)
end
- protected :#{selector}
- END_EVAL
+
+ protected selector
+ end
helpers << selector
end

0 comments on commit 0035c54

Please sign in to comment.
Something went wrong with that request. Please try again.