aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'constraints'Aaron Patterson2014-05-272-10/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * constraints: rm reset_parameters because we automatically do it from 9ca4839a move path_parameter encoding check to the request object dispatcher doesn't need `call` anymore call `serve` with the request on dispatchers constraints class does not need the request class anymore give all endpoints a superclass skip the build business if the stack is empty stop hardcoding path_parameters and get it from the request we do not need to cache rack_app a redirect is not a dispatcher by definition, so eliminate test push is_a check up to where the Constraints object is allocated pass the request object to the application pass a request to `matches?` so we can avoid creating excess requests nothing is passed to `rack_app` anymore, so rm the params one fewer is_a check Constraints#app should never return another Constraints object, so switch to if statement eliminate dispatcher is_a checks push is_a?(Dispatcher) check in to one place Always construct route objects with Constraint objects Conflicts: actionpack/lib/action_controller/metal.rb
| * pass the request object to the applicationAaron Patterson2014-05-251-1/+1
| |
| * push is_a?(Dispatcher) check in to one placeAaron Patterson2014-05-241-9/+1
| |
* | Merge pull request #15321 from ↵Santiago Pastorino2014-05-271-1/+4
|\ \ | | | | | | | | | | | | tgxworld/only_find_routes_as_heads_for_head_request Call get_routes_as_head only on HEAD requests.
| * | Call get_routes_as_head only on HEAD requests.Guo Xiang Tan2014-05-251-1/+4
| |/
* / Remove unnecessary flatten! method call.Guo Xiang Tan2014-05-251-3/+1
|/
* unwrap the constraints object on initialization, eliminate loopsAaron Patterson2014-05-241-1/+1
| | | | | | | Unwrap Constraints objects. I don't actually think it's possible to pass a Constraints object to this constructor, but there were multiple places that kept testing children of this object. I *think* they were just being defensive, but I have no idea.
* Fix router visualizer CSS and JS resourcesFranco Catena2014-05-231-2/+2
|
* there is no formatter on the router object, so rmAaron Patterson2014-05-231-1/+0
|
* Merge pull request #15273 from DNNX/formatter-refactoring-4Rafael Mendonça França2014-05-231-5/+0
|\ | | | | Remove AD::Journey::Formatter#verify_required_parts!
| * Remove AD::Journey::Formatter#verify_required_parts!Viktar Basharymau2014-05-231-5/+0
| | | | | | | | | | Nobody uses this private method, maybe it is a leftover from some old refactoring. Let's delete it.
* | decouple the router object from the request classAaron Patterson2014-05-231-5/+3
| |
* | pass the correct custom request to the recognize methodAaron Patterson2014-05-231-3/+1
| |
* | switch to the `serve` method so we can remove the request class (eventually)Aaron Patterson2014-05-231-6/+0
| |
* | extract request allocation from the main app serving routineAaron Patterson2014-05-231-2/+4
| |
* | use the accessors on the request object rather than touching envAaron Patterson2014-05-231-2/+2
| |
* | find_routes only use the request, so stop passing envAaron Patterson2014-05-231-3/+3
| |
* | remove NullRequest and just always pass a request classAaron Patterson2014-05-231-26/+1
| |
* | use the request object since we have itAaron Patterson2014-05-231-8/+9
|/ | | | | stop hardcoding hash keys and use the accessors provided on the request object.
* stop using PARAMETERS_KEY, and use the accessor on the request objectAaron Patterson2014-05-221-6/+6
| | | | this decouples our code from the env hash a bit.
* pass the instantiated request to the find_routes methodAaron Patterson2014-05-221-5/+7
|
* Merge pull request #15254 from DNNX/formatter-refactoring-3Rafael Mendonça França2014-05-221-4/+4
|\ | | | | Rename `stack` to `queue`
| * Rename `stack` to `queue`Viktar Basharymau2014-05-221-4/+4
| | | | | | | | | | | | | | Because it is used as a queue (FIFO), not as a stack (LIFO). * http://en.wikipedia.org/wiki/Stack_(abstract_data_type) * http://en.wikipedia.org/wiki/Queue_(data_structure)
* | Merge pull request #15252 from DNNX/formatter-refactoring-2Rafael Mendonça França2014-05-221-1/+1
|\ \ | | | | | | Remove unnecessary `Hash#to_a` call
| * | Remove unnecessary `Hash#to_a` callViktar Basharymau2014-05-221-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by https://github.com/rails/rails/commit/931ee4186b877856b212b0085cd7bd7f6a4aea67 ```ruby def stat(num) start = GC.stat(:total_allocated_object) num.times { yield } total_obj_count = GC.stat(:total_allocated_object) - start puts "#{total_obj_count / num} allocations per call" end h = { 'x' => 'y' } stat(100) { h. each { |pair| pair } } stat(100) { h.to_a.each { |pair| pair } } __END__ 1 allocations per call 2 allocations per call ```
* / Use `break` instead of `next` in AD::Journey::Formatter#match_routeViktar Basharymau2014-05-221-1/+1
|/ | | | | | The array is sorted in descending order, so there is no point in iterating further if we met a negative item - all the rest will be negative too.
* drop hash allocations during matchAaron Patterson2014-05-211-2/+2
|
* fewer object allocations and method calls during route matchAaron Patterson2014-05-211-5/+5
|
* middle variable is never used, so rmAaron Patterson2014-05-211-1/+1
|
* reuse path formatter from the non-optimized path.Aaron Patterson2014-05-212-33/+2
| | | | | The optimized and non-optimized path share more code now without significant performance degretation
* make variable name more clearAaron Patterson2014-05-211-2/+2
|
* do not mutate parameters, let the caller do mutationsAaron Patterson2014-05-212-4/+6
|
* push the formatter up to the Route objectAaron Patterson2014-05-212-4/+4
|
* we don't use this parameter for anything, so rmAaron Patterson2014-05-201-1/+1
|
* remove dead codeAaron Patterson2014-05-201-57/+0
|
* cache the formatter on the path objectAaron Patterson2014-05-202-2/+6
|
* translate AST to a formatter before url generationAaron Patterson2014-05-202-1/+72
|
* prepopulate the dispatch cache so we don't need the ThreadSafe cache.Aaron Patterson2014-05-201-7/+9
|
* make the each visitor top-down left-rightAaron Patterson2014-05-201-1/+1
|
* make the AST go from left to right, rather than right to leftAaron Patterson2014-05-192-45/+48
|
* fix escaping in generationAaron Patterson2014-05-191-1/+7
|
* Revert "Rewrite journey routes formatter for performance"Aaron Patterson2014-05-191-28/+23
| | | | | | | | | | This reverts commit 5c224de9e110763ec7a0f01f5b604bcf81f40bfb. Conflicts: actionpack/lib/action_dispatch/journey/visitors.rb 5c224de9e110763ec7a0f01f5b604bcf81f40bfb introduced a bug in the formatter. This commit includes a regression test.
* Make URL escaping more consistentAndrew White2014-04-203-4/+30
| | | | | | | | | | | | | | | | | | | | | | 1. Escape '%' characters in URLs - only unescaped data should be passed to URL helpers 2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters 3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation 4. Use `escape_segment` rather than `escape_path` in URL generation For point 4 there are two exceptions. Firstly, when a route uses wildcard segments (e.g. *foo) then we use `escape_path` as the value may contain '/' characters. This means that wildcard routes can't be optimized. Secondly, if a `:controller` segment is used in the path then this uses `escape_path` as the controller may be namespaced. Fixes #14629, #14636 and #14070.
* Optimize URI escapingAndrew White2014-04-201-17/+42
| | | | | | | | | | | | | The URI::Parser#escape method is a general use method that has to deal with a variety of input however our use of it is limited in scope so we can increase the performance by implementing our specific needs within ActionDispatch::Journey::Router::Utils directly. If there is no encoding required then there is no change in performance or number of objects allocated, but for each character that needs to be encoded we save five object allocations and gain a performance boost. The performance boost seen varies from 20% when there is one character to over 50% when encoding ten characters.
* Always escape string passed to url helper.edogawaconan2014-04-201-1/+1
| | | | | | | | | | Makes it clear that anything passed with the helper must not be percent encoded. Fixes previous behavior which tricks people into believing passing non-percent-encoded will generate a proper percent-encoded path while in reality it doesn't ('%' isn't escaped). The intention is nice but the heuristic is broken.
* push move_string in to `move`Aaron Patterson2014-04-011-14/+12
|
* combine move_regexp and move_string so we only loop over states onceAaron Patterson2014-04-011-9/+6
|
* do not create memo objects since we'll just throw them awayAaron Patterson2014-04-012-9/+11
|
* only ask if `t` is empty once.Aaron Patterson2014-04-011-4/+1
|
* Replace map.flatten with flat_map in actionpackErik Michaels-Ober2014-03-037-18/+18
|