aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey
Commit message (Collapse)AuthorAgeFilesLines
* Avoid duplicating routes for HEAD requests.Guo Xiang Tan2014-08-211-17/+23
| | | | | | | | Follow up to rails#15321 Instead of duplicating the routes, we will first match the HEAD request to HEAD routes. If no match is found, we will then map the HEAD request to GET routes.
* Using no_result_var in Journey's parser generatorJack Danger Canty2014-08-032-43/+33
| | | | | | | | | | | Previously the generated parser had an intermediate local variable `result` that really useful if you're building up a stateful object but Journey always discards the result argument to the reduce functions. This produces a simpler parser for anybody who actually wants to read the thing. Sadly, there's no real performance speedup with this change.
* `recall` should be `path_parameters`, also make it requiredAaron Patterson2014-07-171-3/+3
| | | | | | | | "recall" is a terrible name. This variable contains the parameters that we got from the path (e.g. for "/posts/1" it has :controller => "posts", :id => "1"). Since it contains the parameters we got from the path, "path_parameters" is a better name. We always pass path_parameters to `generate`, so lets make it required.
* Force encoding of US-ASCII to UTF-8 in unescape_uri.Karl Entwistle2014-07-101-5/+7
| | | | | | | | | Because URI paths may contain non US-ASCII characters we need to force the encoding of any unescaped URIs to UTF-8 if they are US-ASCII. This essentially replicates the functionality of the monkey patch to URI.parser.unescape in active_support/core_ext/uri.rb. Fixes #16104.
* Replace x.sort_by!.select! with x.select!.sort_by!Viktar Basharymau2014-06-201-1/+2
| | | | | | | | | The latter has the same speed as the former in the worst case and faster in general, because it is always better to sort less items. Unfortunately, `routes.select!{...}.sort_by!{...}` is not possible here because `select!` returns `nil`, so select! and sort! must be done in two steps.
* Fix request's path_info when a rack app mounted at '/'.Larry Lv2014-06-141-0/+1
| | | | Fixes issue #15511.
* no more is_a checks on instantiationAaron Patterson2014-05-291-9/+4
|
* Path::Pattern is instantiated internally, so make the contructor require a ↵Aaron Patterson2014-05-291-7/+6
| | | | strexp object
* Strexp#names is only used in a test, so rmAaron Patterson2014-05-291-4/+0
|
* add an alternate constructor to Strexp that takes a stringAaron Patterson2014-05-291-7/+9
|
* ask the strexp for the astAaron Patterson2014-05-292-3/+7
|
* use a parser to extract the group parts from the pathAaron Patterson2014-05-291-0/+4
|
* 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
|