Aaron Patterson
4797c4caca
move path_parameter encoding check to the request object
2014-05-27 14:01:30 -07:00
Aaron Patterson
97a52283f8
dispatcher doesn't need call
anymore
2014-05-27 13:54:59 -07:00
Aaron Patterson
9ad01d0ade
call serve
with the request on dispatchers
2014-05-27 13:51:58 -07:00
Aaron Patterson
7fe14432d8
constraints class does not need the request class anymore
2014-05-27 13:44:58 -07:00
Aaron Patterson
402c2af550
give all endpoints a superclass
2014-05-27 12:10:24 -07:00
Aaron Patterson
40514aa23a
skip the build business if the stack is empty
2014-05-26 17:30:17 -07:00
Aaron Patterson
02a9401d78
stop hardcoding path_parameters and get it from the request
2014-05-26 17:19:54 -07:00
Aaron Patterson
d1012b669e
we do not need to cache rack_app
2014-05-26 15:43:14 -07:00
Aaron Patterson
8a826f5d63
a redirect is not a dispatcher by definition, so eliminate test
2014-05-26 13:24:03 -07:00
Aaron Patterson
605ab030a9
push is_a check up to where the Constraints object is allocated
2014-05-26 13:20:43 -07:00
Aaron Patterson
b18f22d15c
pass the request object to the application
2014-05-25 14:26:48 -07:00
Aaron Patterson
62c013d7b1
pass a request to matches?
so we can avoid creating excess requests
2014-05-25 14:11:34 -07:00
Aaron Patterson
cff0d15e4b
nothing is passed to rack_app
anymore, so rm the params
2014-05-25 14:06:20 -07:00
Aaron Patterson
c1bc70e229
one fewer is_a check
2014-05-25 14:04:08 -07:00
Aaron Patterson
8a51ec0158
Constraints#app should never return another Constraints object, so switch to if statement
2014-05-25 13:43:14 -07:00
Aaron Patterson
b6ec5e2c14
eliminate dispatcher is_a checks
2014-05-24 19:07:26 -07:00
Aaron Patterson
633589c140
push is_a?(Dispatcher) check in to one place
2014-05-24 19:03:12 -07:00
Aaron Patterson
229c9ed896
Always construct route objects with Constraint objects
2014-05-24 18:53:30 -07:00
Aaron Patterson
98c7fe8769
unwrap the constraints object on initialization, eliminate loops
...
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.
2014-05-24 17:52:22 -07:00
Rafael Mendonça França
ade105be40
Merge pull request #14986 from dlangevin/trailing-slash-url-generation
...
Fixes URL generation with trailing_slash: true
Conflicts:
actionpack/lib/action_dispatch/http/url.rb
2014-05-24 12:41:28 -03:00
Rafael Mendonça França
fc6e86170f
Merge pull request #15291 from francocatena/router-visualizer-fix
...
Fix router visualizer CSS and JS resources
2014-05-23 21:02:45 -03:00
Franco Catena
aac85defa4
Fix router visualizer CSS and JS resources
2014-05-23 20:38:34 -03:00
Aaron Patterson
cf2a40b8ac
Constraints contructor should always return a Constraints object
...
I know, it's crazy.
2014-05-23 16:29:06 -07:00
Aaron Patterson
2b7b136e0a
default value is never used, so make it required
2014-05-23 16:05:33 -07:00
Aaron Patterson
d991b67040
push options decomposition up so we can extract
2014-05-23 15:55:56 -07:00
Godfrey Chan
3bc684bf04
Merge pull request #15289 from zzak/future_port_c8ddb61
...
Future port c8ddb61 [ci skip]
2014-05-23 15:47:53 -07:00
Aaron Patterson
6d48d97947
glob_param is never used, so rm
...
this also changes the constructor. We don't need to pass more options
than "defaults" (whatever defaults are, ugh. probably another hash of
stupid stuff).
2014-05-23 15:25:46 -07:00
Zachary Scott
1d7b3fa84c
Future port c8ddb61
2014-05-23 14:45:21 -07:00
Aaron Patterson
93ae747c59
use Proc.new to automatically do parameter checking for us
2014-05-23 11:21:26 -07:00
Aaron Patterson
02f3081332
there is no formatter on the router object, so rm
2014-05-23 10:59:44 -07:00
Rafael Mendonça França
7d457e9c70
Merge pull request #15273 from DNNX/formatter-refactoring-4
...
Remove AD::Journey::Formatter#verify_required_parts!
2014-05-23 14:58:00 -03:00
Aaron Patterson
0f5e3a9f6b
decouple the router object from the request class
2014-05-23 10:57:25 -07:00
Aaron Patterson
6fd8346400
pass the correct custom request to the recognize method
2014-05-23 10:57:25 -07:00
Aaron Patterson
6ed5b01f97
switch to the serve
method so we can remove the request class (eventually)
2014-05-23 10:57:25 -07:00
Aaron Patterson
f1175448ec
pull request allocation up one frame
2014-05-23 10:57:25 -07:00
Aaron Patterson
aaceca625d
extract request allocation from the main app serving routine
2014-05-23 10:57:25 -07:00
Aaron Patterson
ca02296706
use the accessors on the request object rather than touching env
2014-05-23 10:17:57 -07:00
Aaron Patterson
559d89c5b3
find_routes only use the request, so stop passing env
2014-05-23 10:16:03 -07:00
Aaron Patterson
890e0a97fb
remove NullRequest and just always pass a request class
2014-05-23 10:09:24 -07:00
Aaron Patterson
a6e94547e8
use the request object since we have it
...
stop hardcoding hash keys and use the accessors provided on the request
object.
2014-05-23 09:56:33 -07:00
Viktar Basharymau
fd03569210
Remove AD::Journey::Formatter#verify_required_parts!
...
Nobody uses this private method, maybe it is a leftover from some old
refactoring. Let's delete it.
2014-05-23 18:00:50 +03:00
Aaron Patterson
9ca4839a1a
stop using PARAMETERS_KEY, and use the accessor on the request object
...
this decouples our code from the env hash a bit.
2014-05-22 15:57:24 -07:00
Aaron Patterson
1b76c7e9f6
pass the instantiated request to the find_routes method
2014-05-22 15:46:38 -07:00
Aaron Patterson
8d8ebe3db5
just return path parameters
2014-05-22 15:37:56 -07:00
Aaron Patterson
925bd97566
use symbol keys for path_parameters
2014-05-22 15:37:56 -07:00
Dan Langevin
82b4d879bf
Fixes URL generation with trailing_slash: true
...
URL generation with trailing_slash: true was adding a trailing slash
after .:format
Routes.draw do
resources :bars
end
bars_url(trailing_slash: true, format: 'json')
# => /bars.json/
This commit removes that extra trailing slash
2014-05-22 16:03:52 -04:00
Rafael Mendonça França
70ec49c87a
Merge pull request #15254 from DNNX/formatter-refactoring-3
...
Rename `stack` to `queue`
2014-05-22 16:02:23 -03:00
Rafael Mendonça França
35c160066a
Merge pull request #15252 from DNNX/formatter-refactoring-2
...
Remove unnecessary `Hash#to_a` call
2014-05-22 15:40:15 -03:00
Viktar Basharymau
2dafd87edd
Rename stack
to queue
...
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)
2014-05-22 21:33:26 +03:00
Viktar Basharymau
ee92c61689
Remove unnecessary Hash#to_a
call
...
Inspired by 931ee4186b
```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
```
2014-05-22 21:16:56 +03:00