Browse files

this is not a good override of clone

  • Loading branch information...
1 parent cf69835 commit fc6708036024591b189d92207e4e6a817d5809e7 @joshbuddy committed Oct 3, 2011
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/http_router.rb
  2. +2 −2 lib/http_router/route.rb
View
2 lib/http_router.rb
@@ -218,7 +218,7 @@ def redirect_trailing_slash?
def clone(klass = self.class)
cloned_router = klass.new(@options)
@routes.each do |route|
- new_route = route.clone(cloned_router)
+ new_route = route.create_clone(cloned_router)
cloned_router.add_route(new_route)
end
cloned_router
View
4 lib/http_router/route.rb
@@ -8,8 +8,8 @@ class Route
attr_accessor :match_partially, :router, :host, :user_agent, :ignore_trailing_slash,
:path_for_generation, :path_validation_regex, :generator, :scheme, :original_path, :dest
- def clone(new_router)
- r = super()
+ def create_clone(new_router)
+ r = clone
r.dest = (begin; dest.clone; rescue; dest; end)
r
end

0 comments on commit fc67080

Please sign in to comment.