Commit Graph

19 Commits

Author SHA1 Message Date
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
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
Viktar Basharymau
eba8b70d4e Use break instead of next in AD::Journey::Formatter#match_route
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.
2014-05-22 17:44:25 +03:00
Aaron Patterson
7bc25f0035 do not mutate parameters, let the caller do mutations 2014-05-21 14:27:30 -07:00
Aaron Patterson
089d9baa33 we don't use this parameter for anything, so rm 2014-05-20 16:06:59 -07:00
Erik Michaels-Ober
b11ebf1d80 Replace map.flatten(1) with flat_map 2014-02-28 22:46:25 -08:00
Andrew White
892c539591 Show full route constraints in error message
When an optimized helper fails to generate, show the full route constraints
in the error message. Previously it would only show the contraints that were
required as part of the path.

Fixes #13592
2014-01-05 10:27:46 +00:00
Andrew White
1555a1800e Skip Rack applications and redirects when generating urls
When generating an unnamed url (i.e. using `url_for` with an options
hash) we should skip anything other than standard Rails routes otherwise
it will match the first mounted application or redirect and generate a
url with query parameters rather than raising an error if the options
hash doesn't match any defined routes.

Fixes #8018
2013-07-16 13:39:17 +01:00
Prathamesh Sonpatki
39b8b8fdbf rails -> Rails [ci skip] 2013-05-09 17:27:58 +05:30
Agis Anastasopoulos
a779ea9d57 Mark unused variables and make some style fixes
It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
2013-04-08 22:52:32 +03:00
Andrew White
db06d12826 Raise correct exception now Journey is integrated.
Now that Journey has been integrated into ActionDispatch we can raise
the exception ActionController::UrlGenerationError directly rather than
raising the internal Journey::Router::RoutingError and then have
ActionDispatch::Routing::RouteSet#generate re-raise the exception.
2013-01-15 17:21:33 +00:00
Gosha Arinich
8ef780c3e2 remove another unnecessary dup 2013-01-02 19:29:50 +03:00
Gosha Arinich
aca0c6d315 remove unnecessary #dup 2013-01-02 18:33:52 +03:00
Francesco Rodriguez
eb493f5ac8 update AD::Journey to follow Rails coding conventions 2012-12-20 15:42:39 -05:00
Francesco Rodriguez
a36ae63d07 :nodoc: Journey because is not part of the public API [ci skip] 2012-12-19 19:24:25 -05:00
Andrew White
56fee39c39 Integrate Journey into Action Dispatch
Move the Journey code underneath the ActionDispatch namespace so
that we don't pollute the global namespace with names that may
be used for models.

Fixes rails/journey#49.
2012-12-19 22:13:08 +00:00