aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey
Commit message (Collapse)AuthorAgeFilesLines
...
* | Use block variable instead of globalschneems2015-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```ruby require 'benchmark/ips' Benchmark.ips do |x| x.report("$&") { "foo".sub(/f/) { $&.upcase } } x.report("block var") { "foo".sub(/f/) {|match| match.upcase } } end ``` ``` Calculating ------------------------------------- $& 48.658k i/100ms block var 49.666k i/100ms ------------------------------------------------- $& 873.156k (± 9.3%) i/s - 4.331M block var 969.744k (± 9.2%) i/s - 4.818M ``` It's faster, and gets rid of a few "magic" global variables
* | ActionDispatch::Journey::Routes#empty? test casesValentine Valyaeff2015-05-191-1/+1
| |
* | Added ActionDispatch::Journey::Routes#empty?juggernaut-2015-05-181-0/+4
| |
* | Merge pull request #18392 from brainopia/fix_route_requirementsArthur Nogueira Neves2015-04-271-1/+1
|\ \ | | | | | | Correct route requirements by overriding defaultls
| * | Correct route requirements by overriding defaultls (fixes #18373)brainopia2015-01-081-1/+1
| | |
* | | sort_by instead of sortYang Bo2015-04-081-1/+1
| |/ |/| | | | | | | | | it is avoid sort errot within different and mixed keys. used `sort_by` + `block` to list parameter by keys. keep minimum changes
* | Merge pull request #15806 from tgxworld/partition_routes_during_setupAaron Patterson2015-03-022-8/+13
|\ \ | | | | | | Partition routes during setup.
| * | Partition routes during setup.Guo Xiang Tan2015-02-262-8/+13
| | | | | | | | | | | | | | | | | | | | | Partitioning of all the routes is currently being done during the first request. Since there is no need to clear the cache for `partitioned_routes` when adding a new route. We can move the partitioning of the routes during setup time.
* | | Revert "Merge pull request #18764 from tsun1215/master"Jeremy Kemper2015-02-261-1/+0
|/ / | | | | | | | | This reverts commit b6dd0c4ddebf5e7aab0a669915cb349ec65e5b88, reversing changes made to de9a3748c436f849dd1877851115cd94663c2725.
* / Explicitly ignored wildcard verbs from head_routesTerence Sun2015-02-081-0/+1
|/ | | | | | In match_head_routes, deleted the routes in which request.request_method was empty (matches all HTTP verbs) when responding to a HEAD request. This prevents catch-all routes (such as Racks) from intercepting the HEAD request. Fixes #18698
* Remove some comments about Ruby 1.9 behaviorsRafael Mendonça França2015-01-041-1/+1
|
* Remove deprecated option `use_route` in controller testsRafael Mendonça França2015-01-041-15/+0
|
* remove unused `#optional_parts`Sergey Alekseev2014-12-051-4/+0
| | | | | This method was copied from journey at https://github.com/rails/rails/commit/56fee39c392788314c44a575b3fd66e16a50c8b5#diff-2cfaf53c860732fea8689d6f2002594bR78. `grep -nr 'optional_parts' .`
* remove unused `#generalized_table`Sergey Alekseev2014-12-051-45/+0
| | | | This method wass copied from journey at https://github.com/rails/rails/commit/56fee39c392788314c44a575b3fd66e16a50c8b5#diff-d89de8881fc4b9f10cb3e4fc7b2463f3R53. However it looks the method was unused in journey at those point as well.
* Merge pull request #17827 from rkh/rkh-fix-or-patternAaron Patterson2014-12-011-0/+5
|\ | | | | Fix OR in Journey patterns
| * make OR in journey patterns compile to a valid regular expressionKonstantin Haase2014-11-291-0/+5
| |
* | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-294-8/+8
|/
* CSS fix for the router visualizerBruno Sutic2014-11-251-4/+0
|
* Don't show the warning if we're already raising the error anywayGodfrey Chan2014-11-231-8/+13
| | | | | | | | | If the route set is empty, or if none of the routes matches with a score > 0, there is no point showing the deprecation message because we are already be raising the `ActionController::UrlGenerationError` mentioned in the warning. In this case it is the expected behavior and the user wouldn't have to take any actions.
* Deprecate passing an invalid name to `Formatter#generate`Godfrey Chan2014-11-231-0/+10
| | | | | | | | The internal tests that (incorrectly) relied on this were already fixed in 938d130. However, we cannot simply fix this bug because the guides prior to b7b9e92 recommended a workaround that relies on this buggy behavior. Reference #17453
* fix url generation error messageAccessd2014-10-211-1/+1
|
* Use `#tr` instead of `#gsub`Nicolas Cavigneaux2014-10-141-1/+1
| | | | | `#tr` is more efficient than `#gsub` and can be used as a drop in replacement in this context.
* Improve Journey compliance to RFC 3986Nicolas Cavigneaux2014-10-141-5/+5
| | | | | | | | | | The scanner in Journey fails to recognize routes that use literals from the sub-delims section of RFC 3986. This commit enhance the compatibility of Journey with the RFC by adding support of authorized delimiters to the scanner. Fix #17212
* Replace Array#shuffle.first with Array#sampleErik Michaels-Ober2014-10-131-2/+2
|
* 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
| |