actionpack 4.2.8 → 5.2.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (166) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +285 -444
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +6 -7
  5. data/lib/abstract_controller.rb +12 -5
  6. data/lib/abstract_controller/asset_paths.rb +2 -0
  7. data/lib/abstract_controller/base.rb +45 -49
  8. data/lib/abstract_controller/caching.rb +66 -0
  9. data/lib/{action_controller → abstract_controller}/caching/fragments.rb +78 -15
  10. data/lib/abstract_controller/callbacks.rb +47 -31
  11. data/lib/abstract_controller/collector.rb +8 -11
  12. data/lib/abstract_controller/error.rb +6 -0
  13. data/lib/abstract_controller/helpers.rb +25 -25
  14. data/lib/abstract_controller/logger.rb +2 -0
  15. data/lib/abstract_controller/railties/routes_helpers.rb +4 -2
  16. data/lib/abstract_controller/rendering.rb +42 -41
  17. data/lib/abstract_controller/translation.rb +10 -7
  18. data/lib/abstract_controller/url_for.rb +2 -0
  19. data/lib/action_controller.rb +29 -21
  20. data/lib/action_controller/api.rb +149 -0
  21. data/lib/action_controller/api/api_rendering.rb +16 -0
  22. data/lib/action_controller/base.rb +27 -19
  23. data/lib/action_controller/caching.rb +14 -57
  24. data/lib/action_controller/form_builder.rb +50 -0
  25. data/lib/action_controller/log_subscriber.rb +10 -15
  26. data/lib/action_controller/metal.rb +98 -83
  27. data/lib/action_controller/metal/basic_implicit_render.rb +13 -0
  28. data/lib/action_controller/metal/conditional_get.rb +118 -44
  29. data/lib/action_controller/metal/content_security_policy.rb +52 -0
  30. data/lib/action_controller/metal/cookies.rb +3 -3
  31. data/lib/action_controller/metal/data_streaming.rb +27 -46
  32. data/lib/action_controller/metal/etag_with_flash.rb +18 -0
  33. data/lib/action_controller/metal/etag_with_template_digest.rb +20 -13
  34. data/lib/action_controller/metal/exceptions.rb +8 -14
  35. data/lib/action_controller/metal/flash.rb +4 -3
  36. data/lib/action_controller/metal/force_ssl.rb +23 -21
  37. data/lib/action_controller/metal/head.rb +21 -19
  38. data/lib/action_controller/metal/helpers.rb +24 -14
  39. data/lib/action_controller/metal/http_authentication.rb +64 -57
  40. data/lib/action_controller/metal/implicit_render.rb +62 -8
  41. data/lib/action_controller/metal/instrumentation.rb +19 -21
  42. data/lib/action_controller/metal/live.rb +90 -106
  43. data/lib/action_controller/metal/mime_responds.rb +33 -46
  44. data/lib/action_controller/metal/parameter_encoding.rb +51 -0
  45. data/lib/action_controller/metal/params_wrapper.rb +61 -53
  46. data/lib/action_controller/metal/redirecting.rb +49 -28
  47. data/lib/action_controller/metal/renderers.rb +87 -44
  48. data/lib/action_controller/metal/rendering.rb +72 -50
  49. data/lib/action_controller/metal/request_forgery_protection.rb +203 -92
  50. data/lib/action_controller/metal/rescue.rb +9 -16
  51. data/lib/action_controller/metal/streaming.rb +12 -10
  52. data/lib/action_controller/metal/strong_parameters.rb +582 -165
  53. data/lib/action_controller/metal/testing.rb +2 -17
  54. data/lib/action_controller/metal/url_for.rb +19 -10
  55. data/lib/action_controller/railtie.rb +28 -10
  56. data/lib/action_controller/railties/helpers.rb +2 -0
  57. data/lib/action_controller/renderer.rb +117 -0
  58. data/lib/action_controller/template_assertions.rb +11 -0
  59. data/lib/action_controller/test_case.rb +280 -411
  60. data/lib/action_dispatch.rb +27 -19
  61. data/lib/action_dispatch/http/cache.rb +93 -47
  62. data/lib/action_dispatch/http/content_security_policy.rb +272 -0
  63. data/lib/action_dispatch/http/filter_parameters.rb +26 -20
  64. data/lib/action_dispatch/http/filter_redirect.rb +10 -11
  65. data/lib/action_dispatch/http/headers.rb +55 -22
  66. data/lib/action_dispatch/http/mime_negotiation.rb +60 -41
  67. data/lib/action_dispatch/http/mime_type.rb +134 -121
  68. data/lib/action_dispatch/http/mime_types.rb +20 -6
  69. data/lib/action_dispatch/http/parameter_filter.rb +25 -11
  70. data/lib/action_dispatch/http/parameters.rb +98 -39
  71. data/lib/action_dispatch/http/rack_cache.rb +2 -0
  72. data/lib/action_dispatch/http/request.rb +200 -118
  73. data/lib/action_dispatch/http/response.rb +225 -110
  74. data/lib/action_dispatch/http/upload.rb +12 -6
  75. data/lib/action_dispatch/http/url.rb +110 -28
  76. data/lib/action_dispatch/journey.rb +7 -5
  77. data/lib/action_dispatch/journey/formatter.rb +55 -32
  78. data/lib/action_dispatch/journey/gtg/builder.rb +7 -5
  79. data/lib/action_dispatch/journey/gtg/simulator.rb +3 -9
  80. data/lib/action_dispatch/journey/gtg/transition_table.rb +17 -16
  81. data/lib/action_dispatch/journey/nfa/builder.rb +5 -3
  82. data/lib/action_dispatch/journey/nfa/dot.rb +13 -13
  83. data/lib/action_dispatch/journey/nfa/simulator.rb +3 -1
  84. data/lib/action_dispatch/journey/nfa/transition_table.rb +5 -48
  85. data/lib/action_dispatch/journey/nodes/node.rb +18 -6
  86. data/lib/action_dispatch/journey/parser.rb +23 -22
  87. data/lib/action_dispatch/journey/parser.y +3 -2
  88. data/lib/action_dispatch/journey/parser_extras.rb +12 -4
  89. data/lib/action_dispatch/journey/path/pattern.rb +50 -44
  90. data/lib/action_dispatch/journey/route.rb +106 -28
  91. data/lib/action_dispatch/journey/router.rb +35 -23
  92. data/lib/action_dispatch/journey/router/utils.rb +20 -11
  93. data/lib/action_dispatch/journey/routes.rb +18 -16
  94. data/lib/action_dispatch/journey/scanner.rb +18 -15
  95. data/lib/action_dispatch/journey/visitors.rb +99 -52
  96. data/lib/action_dispatch/middleware/callbacks.rb +1 -2
  97. data/lib/action_dispatch/middleware/cookies.rb +304 -193
  98. data/lib/action_dispatch/middleware/debug_exceptions.rb +152 -57
  99. data/lib/action_dispatch/middleware/debug_locks.rb +124 -0
  100. data/lib/action_dispatch/middleware/exception_wrapper.rb +68 -69
  101. data/lib/action_dispatch/middleware/executor.rb +21 -0
  102. data/lib/action_dispatch/middleware/flash.rb +78 -54
  103. data/lib/action_dispatch/middleware/public_exceptions.rb +27 -25
  104. data/lib/action_dispatch/middleware/reloader.rb +5 -91
  105. data/lib/action_dispatch/middleware/remote_ip.rb +41 -31
  106. data/lib/action_dispatch/middleware/request_id.rb +17 -9
  107. data/lib/action_dispatch/middleware/session/abstract_store.rb +41 -25
  108. data/lib/action_dispatch/middleware/session/cache_store.rb +24 -14
  109. data/lib/action_dispatch/middleware/session/cookie_store.rb +72 -67
  110. data/lib/action_dispatch/middleware/session/mem_cache_store.rb +8 -2
  111. data/lib/action_dispatch/middleware/show_exceptions.rb +26 -22
  112. data/lib/action_dispatch/middleware/ssl.rb +114 -36
  113. data/lib/action_dispatch/middleware/stack.rb +31 -44
  114. data/lib/action_dispatch/middleware/static.rb +57 -50
  115. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +2 -14
  116. data/lib/action_dispatch/middleware/templates/rescues/{_source.erb → _source.html.erb} +0 -0
  117. data/lib/action_dispatch/middleware/templates/rescues/_source.text.erb +8 -0
  118. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +21 -0
  119. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +13 -0
  120. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +1 -0
  121. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -1
  122. data/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +1 -1
  123. data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +4 -4
  124. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +64 -64
  125. data/lib/action_dispatch/railtie.rb +19 -11
  126. data/lib/action_dispatch/request/session.rb +106 -59
  127. data/lib/action_dispatch/request/utils.rb +67 -24
  128. data/lib/action_dispatch/routing.rb +17 -18
  129. data/lib/action_dispatch/routing/endpoint.rb +9 -2
  130. data/lib/action_dispatch/routing/inspector.rb +58 -67
  131. data/lib/action_dispatch/routing/mapper.rb +734 -447
  132. data/lib/action_dispatch/routing/polymorphic_routes.rb +161 -139
  133. data/lib/action_dispatch/routing/redirection.rb +36 -26
  134. data/lib/action_dispatch/routing/route_set.rb +321 -291
  135. data/lib/action_dispatch/routing/routes_proxy.rb +32 -5
  136. data/lib/action_dispatch/routing/url_for.rb +65 -25
  137. data/lib/action_dispatch/system_test_case.rb +147 -0
  138. data/lib/action_dispatch/system_testing/browser.rb +49 -0
  139. data/lib/action_dispatch/system_testing/driver.rb +59 -0
  140. data/lib/action_dispatch/system_testing/server.rb +31 -0
  141. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +96 -0
  142. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +31 -0
  143. data/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb +26 -0
  144. data/lib/action_dispatch/testing/assertion_response.rb +47 -0
  145. data/lib/action_dispatch/testing/assertions.rb +6 -4
  146. data/lib/action_dispatch/testing/assertions/response.rb +45 -20
  147. data/lib/action_dispatch/testing/assertions/routing.rb +30 -26
  148. data/lib/action_dispatch/testing/integration.rb +347 -209
  149. data/lib/action_dispatch/testing/request_encoder.rb +55 -0
  150. data/lib/action_dispatch/testing/test_process.rb +28 -22
  151. data/lib/action_dispatch/testing/test_request.rb +27 -34
  152. data/lib/action_dispatch/testing/test_response.rb +35 -7
  153. data/lib/action_pack.rb +4 -2
  154. data/lib/action_pack/gem_version.rb +5 -3
  155. data/lib/action_pack/version.rb +3 -1
  156. metadata +56 -39
  157. data/lib/action_controller/metal/hide_actions.rb +0 -40
  158. data/lib/action_controller/metal/rack_delegation.rb +0 -32
  159. data/lib/action_controller/middleware.rb +0 -39
  160. data/lib/action_controller/model_naming.rb +0 -12
  161. data/lib/action_dispatch/journey/backwards.rb +0 -5
  162. data/lib/action_dispatch/journey/router/strexp.rb +0 -27
  163. data/lib/action_dispatch/middleware/params_parser.rb +0 -60
  164. data/lib/action_dispatch/testing/assertions/dom.rb +0 -3
  165. data/lib/action_dispatch/testing/assertions/selector.rb +0 -3
  166. data/lib/action_dispatch/testing/assertions/tag.rb +0 -3
@@ -1,4 +1,6 @@
1
- require 'action_dispatch/journey/gtg/transition_table'
1
+ # frozen_string_literal: true
2
+
3
+ require "action_dispatch/journey/gtg/transition_table"
2
4
 
3
5
  module ActionDispatch
4
6
  module Journey # :nodoc:
@@ -17,7 +19,7 @@ module ActionDispatch
17
19
  def transition_table
18
20
  dtrans = TransitionTable.new
19
21
  marked = {}
20
- state_id = Hash.new { |h,k| h[k] = h.length }
22
+ state_id = Hash.new { |h, k| h[k] = h.length }
21
23
 
22
24
  start = firstpos(root)
23
25
  dstates = [start]
@@ -75,7 +77,7 @@ module ActionDispatch
75
77
  when Nodes::Unary
76
78
  nullable?(node.left)
77
79
  else
78
- raise ArgumentError, 'unknown nullable: %s' % node.class.name
80
+ raise ArgumentError, "unknown nullable: %s" % node.class.name
79
81
  end
80
82
  end
81
83
 
@@ -96,7 +98,7 @@ module ActionDispatch
96
98
  when Nodes::Terminal
97
99
  nullable?(node) ? [] : [node]
98
100
  else
99
- raise ArgumentError, 'unknown firstpos: %s' % node.class.name
101
+ raise ArgumentError, "unknown firstpos: %s" % node.class.name
100
102
  end
101
103
  end
102
104
 
@@ -117,7 +119,7 @@ module ActionDispatch
117
119
  when Nodes::Unary
118
120
  lastpos(node.left)
119
121
  else
120
- raise ArgumentError, 'unknown lastpos: %s' % node.class.name
122
+ raise ArgumentError, "unknown lastpos: %s" % node.class.name
121
123
  end
122
124
  end
123
125
 
@@ -1,4 +1,6 @@
1
- require 'strscan'
1
+ # frozen_string_literal: true
2
+
3
+ require "strscan"
2
4
 
3
5
  module ActionDispatch
4
6
  module Journey # :nodoc:
@@ -18,14 +20,6 @@ module ActionDispatch
18
20
  @tt = transition_table
19
21
  end
20
22
 
21
- def simulate(string)
22
- ms = memos(string) { return }
23
- MatchData.new(ms)
24
- end
25
-
26
- alias :=~ :simulate
27
- alias :match :simulate
28
-
29
23
  def memos(string)
30
24
  input = StringScanner.new(string)
31
25
  state = [0]
@@ -1,4 +1,6 @@
1
- require 'action_dispatch/journey/nfa/dot'
1
+ # frozen_string_literal: true
2
+
3
+ require "action_dispatch/journey/nfa/dot"
2
4
 
3
5
  module ActionDispatch
4
6
  module Journey # :nodoc:
@@ -12,7 +14,7 @@ module ActionDispatch
12
14
  @regexp_states = {}
13
15
  @string_states = {}
14
16
  @accepting = {}
15
- @memos = Hash.new { |h,k| h[k] = [] }
17
+ @memos = Hash.new { |h, k| h[k] = [] }
16
18
  end
17
19
 
18
20
  def add_accepting(state)
@@ -56,7 +58,7 @@ module ActionDispatch
56
58
  end
57
59
 
58
60
  def as_json(options = nil)
59
- simple_regexp = Hash.new { |h,k| h[k] = {} }
61
+ simple_regexp = Hash.new { |h, k| h[k] = {} }
60
62
 
61
63
  @regexp_states.each do |from, hash|
62
64
  hash.each do |re, to|
@@ -72,20 +74,20 @@ module ActionDispatch
72
74
  end
73
75
 
74
76
  def to_svg
75
- svg = IO.popen('dot -Tsvg', 'w+') { |f|
77
+ svg = IO.popen("dot -Tsvg", "w+") { |f|
76
78
  f.write(to_dot)
77
79
  f.close_write
78
80
  f.readlines
79
81
  }
80
82
  3.times { svg.shift }
81
- svg.join.sub(/width="[^"]*"/, '').sub(/height="[^"]*"/, '')
83
+ svg.join.sub(/width="[^"]*"/, "").sub(/height="[^"]*"/, "")
82
84
  end
83
85
 
84
- def visualizer(paths, title = 'FSM')
85
- viz_dir = File.join File.dirname(__FILE__), '..', 'visualizer'
86
- fsm_js = File.read File.join(viz_dir, 'fsm.js')
87
- fsm_css = File.read File.join(viz_dir, 'fsm.css')
88
- erb = File.read File.join(viz_dir, 'index.html.erb')
86
+ def visualizer(paths, title = "FSM")
87
+ viz_dir = File.join __dir__, "..", "visualizer"
88
+ fsm_js = File.read File.join(viz_dir, "fsm.js")
89
+ fsm_css = File.read File.join(viz_dir, "fsm.css")
90
+ erb = File.read File.join(viz_dir, "index.html.erb")
89
91
  states = "function tt() { return #{to_json}; }"
90
92
 
91
93
  fun_routes = paths.sample(3).map do |ast|
@@ -93,10 +95,10 @@ module ActionDispatch
93
95
  case n
94
96
  when Nodes::Symbol
95
97
  case n.left
96
- when ':id' then rand(100).to_s
97
- when ':format' then %w{ xml json }.sample
98
+ when ":id" then rand(100).to_s
99
+ when ":format" then %w{ xml json }.sample
98
100
  else
99
- 'omg'
101
+ "omg"
100
102
  end
101
103
  when Nodes::Terminal then n.symbol
102
104
  else
@@ -109,13 +111,12 @@ module ActionDispatch
109
111
  svg = to_svg
110
112
  javascripts = [states, fsm_js]
111
113
 
112
- # Annoying hack for 1.9 warnings
113
114
  fun_routes = fun_routes
114
115
  stylesheets = stylesheets
115
116
  svg = svg
116
117
  javascripts = javascripts
117
118
 
118
- require 'erb'
119
+ require "erb"
119
120
  template = ERB.new erb
120
121
  template.result(binding)
121
122
  end
@@ -148,7 +149,7 @@ module ActionDispatch
148
149
  when Regexp
149
150
  @regexp_states
150
151
  else
151
- raise ArgumentError, 'unknown symbol: %s' % sym.class
152
+ raise ArgumentError, "unknown symbol: %s" % sym.class
152
153
  end
153
154
  end
154
155
  end
@@ -1,5 +1,7 @@
1
- require 'action_dispatch/journey/nfa/transition_table'
2
- require 'action_dispatch/journey/gtg/transition_table'
1
+ # frozen_string_literal: true
2
+
3
+ require "action_dispatch/journey/nfa/transition_table"
4
+ require "action_dispatch/journey/gtg/transition_table"
3
5
 
4
6
  module ActionDispatch
5
7
  module Journey # :nodoc:
@@ -36,7 +38,7 @@ module ActionDispatch
36
38
  def visit_OR(node)
37
39
  from = @i += 1
38
40
  children = node.children.map { |c| visit(c) }
39
- to = @i += 1
41
+ to = @i += 1
40
42
 
41
43
  children.each do |child|
42
44
  @tt[from, child.first] = nil
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  module ActionDispatch
4
4
  module Journey # :nodoc:
@@ -9,18 +9,18 @@ module ActionDispatch
9
9
  " #{from} -> #{to} [label=\"#{sym || 'ε'}\"];"
10
10
  }
11
11
 
12
- #memo_nodes = memos.values.flatten.map { |n|
13
- # label = n
14
- # if Journey::Route === n
15
- # label = "#{n.verb.source} #{n.path.spec}"
16
- # end
17
- # " #{n.object_id} [label=\"#{label}\", shape=box];"
18
- #}
19
- #memo_edges = memos.flat_map { |k, memos|
20
- # (memos || []).map { |v| " #{k} -> #{v.object_id};" }
21
- #}.uniq
12
+ # memo_nodes = memos.values.flatten.map { |n|
13
+ # label = n
14
+ # if Journey::Route === n
15
+ # label = "#{n.verb.source} #{n.path.spec}"
16
+ # end
17
+ # " #{n.object_id} [label=\"#{label}\", shape=box];"
18
+ # }
19
+ # memo_edges = memos.flat_map { |k, memos|
20
+ # (memos || []).map { |v| " #{k} -> #{v.object_id};" }
21
+ # }.uniq
22
22
 
23
- <<-eodot
23
+ <<-eodot
24
24
  digraph nfa {
25
25
  rankdir=LR;
26
26
  node [shape = doublecircle];
@@ -28,7 +28,7 @@ digraph nfa {
28
28
  node [shape = circle];
29
29
  #{edges.join "\n"}
30
30
  }
31
- eodot
31
+ eodot
32
32
  end
33
33
  end
34
34
  end
@@ -1,4 +1,6 @@
1
- require 'strscan'
1
+ # frozen_string_literal: true
2
+
3
+ require "strscan"
2
4
 
3
5
  module ActionDispatch
4
6
  module Journey # :nodoc:
@@ -1,4 +1,6 @@
1
- require 'action_dispatch/journey/nfa/dot'
1
+ # frozen_string_literal: true
2
+
3
+ require "action_dispatch/journey/nfa/dot"
2
4
 
3
5
  module ActionDispatch
4
6
  module Journey # :nodoc:
@@ -10,7 +12,7 @@ module ActionDispatch
10
12
  attr_reader :memos
11
13
 
12
14
  def initialize
13
- @table = Hash.new { |h,f| h[f] = {} }
15
+ @table = Hash.new { |h, f| h[f] = {} }
14
16
  @memos = {}
15
17
  @accepting = nil
16
18
  @inverted = nil
@@ -45,51 +47,6 @@ module ActionDispatch
45
47
  (@table.keys + @table.values.flat_map(&:keys)).uniq
46
48
  end
47
49
 
48
- # Returns a generalized transition graph with reduced states. The states
49
- # are reduced like a DFA, but the table must be simulated like an NFA.
50
- #
51
- # Edges of the GTG are regular expressions.
52
- def generalized_table
53
- gt = GTG::TransitionTable.new
54
- marked = {}
55
- state_id = Hash.new { |h,k| h[k] = h.length }
56
- alphabet = self.alphabet
57
-
58
- stack = [eclosure(0)]
59
-
60
- until stack.empty?
61
- state = stack.pop
62
- next if marked[state] || state.empty?
63
-
64
- marked[state] = true
65
-
66
- alphabet.each do |alpha|
67
- next_state = eclosure(following_states(state, alpha))
68
- next if next_state.empty?
69
-
70
- gt[state_id[state], state_id[next_state]] = alpha
71
- stack << next_state
72
- end
73
- end
74
-
75
- final_groups = state_id.keys.find_all { |s|
76
- s.sort.last == accepting
77
- }
78
-
79
- final_groups.each do |states|
80
- id = state_id[states]
81
-
82
- gt.add_accepting(id)
83
- save = states.find { |s|
84
- @memos.key?(s) && eclosure(s).sort.last == accepting
85
- }
86
-
87
- gt.add_memo(id, memo(save))
88
- end
89
-
90
- gt
91
- end
92
-
93
50
  # Returns set of NFA states to which there is a transition on ast symbol
94
51
  # +a+ from some state +s+ in +t+.
95
52
  def following_states(t, a)
@@ -107,7 +64,7 @@ module ActionDispatch
107
64
  end
108
65
 
109
66
  def alphabet
110
- inverted.values.flat_map(&:keys).compact.uniq.sort_by { |x| x.to_s }
67
+ inverted.values.flat_map(&:keys).compact.uniq.sort_by(&:to_s)
111
68
  end
112
69
 
113
70
  # Returns a set of NFA states reachable from some NFA state +s+ in set
@@ -1,4 +1,6 @@
1
- require 'action_dispatch/journey/visitors'
1
+ # frozen_string_literal: true
2
+
3
+ require "action_dispatch/journey/visitors"
2
4
 
3
5
  module ActionDispatch
4
6
  module Journey # :nodoc:
@@ -14,15 +16,15 @@ module ActionDispatch
14
16
  end
15
17
 
16
18
  def each(&block)
17
- Visitors::Each.new(block).accept(self)
19
+ Visitors::Each::INSTANCE.accept(self, block)
18
20
  end
19
21
 
20
22
  def to_s
21
- Visitors::String.new.accept(self)
23
+ Visitors::String::INSTANCE.accept(self, "")
22
24
  end
23
25
 
24
26
  def to_dot
25
- Visitors::Dot.new.accept(self)
27
+ Visitors::Dot::INSTANCE.accept(self)
26
28
  end
27
29
 
28
30
  def to_sym
@@ -30,7 +32,7 @@ module ActionDispatch
30
32
  end
31
33
 
32
34
  def name
33
- left.tr '*:', ''
35
+ left.tr "*:".freeze, "".freeze
34
36
  end
35
37
 
36
38
  def type
@@ -39,10 +41,15 @@ module ActionDispatch
39
41
 
40
42
  def symbol?; false; end
41
43
  def literal?; false; end
44
+ def terminal?; false; end
45
+ def star?; false; end
46
+ def cat?; false; end
47
+ def group?; false; end
42
48
  end
43
49
 
44
50
  class Terminal < Node # :nodoc:
45
51
  alias :symbol :left
52
+ def terminal?; true; end
46
53
  end
47
54
 
48
55
  class Literal < Terminal # :nodoc:
@@ -69,11 +76,13 @@ module ActionDispatch
69
76
  class Symbol < Terminal # :nodoc:
70
77
  attr_accessor :regexp
71
78
  alias :symbol :regexp
79
+ attr_reader :name
72
80
 
73
81
  DEFAULT_EXP = /[^\.\/\?]+/
74
82
  def initialize(left)
75
83
  super
76
84
  @regexp = DEFAULT_EXP
85
+ @name = left.tr "*:".freeze, "".freeze
77
86
  end
78
87
 
79
88
  def default_regexp?
@@ -89,13 +98,15 @@ module ActionDispatch
89
98
 
90
99
  class Group < Unary # :nodoc:
91
100
  def type; :GROUP; end
101
+ def group?; true; end
92
102
  end
93
103
 
94
104
  class Star < Unary # :nodoc:
105
+ def star?; true; end
95
106
  def type; :STAR; end
96
107
 
97
108
  def name
98
- left.name.tr '*:', ''
109
+ left.name.tr "*:", ""
99
110
  end
100
111
  end
101
112
 
@@ -111,6 +122,7 @@ module ActionDispatch
111
122
  end
112
123
 
113
124
  class Cat < Binary # :nodoc:
125
+ def cat?; true; end
114
126
  def type; :CAT; end
115
127
  end
116
128
 
@@ -1,32 +1,33 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.11
4
- # from Racc grammer file "".
3
+ # This file is automatically generated by Racc 1.4.14
4
+ # from Racc grammar file "".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
8
8
 
9
+ # :stopdoc:
9
10
 
10
- require 'action_dispatch/journey/parser_extras'
11
+ require "action_dispatch/journey/parser_extras"
11
12
  module ActionDispatch
12
13
  module Journey
13
14
  class Parser < Racc::Parser
14
15
  ##### State transition tables begin ###
15
16
 
16
17
  racc_action_table = [
17
- 13, 15, 14, 7, 21, 16, 8, 19, 13, 15,
18
- 14, 7, 17, 16, 8, 13, 15, 14, 7, 24,
19
- 16, 8, 13, 15, 14, 7, 19, 16, 8 ]
18
+ 13, 15, 14, 7, 19, 16, 8, 19, 13, 15,
19
+ 14, 7, 17, 16, 8, 13, 15, 14, 7, 21,
20
+ 16, 8, 13, 15, 14, 7, 24, 16, 8 ]
20
21
 
21
22
  racc_action_check = [
22
- 2, 2, 2, 2, 17, 2, 2, 2, 0, 0,
23
- 0, 0, 1, 0, 0, 19, 19, 19, 19, 20,
24
- 19, 19, 7, 7, 7, 7, 22, 7, 7 ]
23
+ 2, 2, 2, 2, 22, 2, 2, 2, 19, 19,
24
+ 19, 19, 1, 19, 19, 7, 7, 7, 7, 17,
25
+ 7, 7, 0, 0, 0, 0, 20, 0, 0 ]
25
26
 
26
27
  racc_action_pointer = [
27
- 6, 12, -2, nil, nil, nil, nil, 20, nil, nil,
28
- nil, nil, nil, nil, nil, nil, nil, 4, nil, 13,
29
- 13, nil, 17, nil, nil ]
28
+ 20, 12, -2, nil, nil, nil, nil, 13, nil, nil,
29
+ nil, nil, nil, nil, nil, nil, nil, 19, nil, 6,
30
+ 20, nil, -5, nil, nil ]
30
31
 
31
32
  racc_action_default = [
32
33
  -19, -19, -2, -3, -4, -5, -6, -19, -10, -11,
@@ -134,11 +135,11 @@ Racc_debug_parser = false
134
135
  # reduce 0 omitted
135
136
 
136
137
  def _reduce_1(val, _values)
137
- Cat.new(val.first, val.last)
138
+ Cat.new(val.first, val.last)
138
139
  end
139
140
 
140
141
  def _reduce_2(val, _values)
141
- val.first
142
+ val.first
142
143
  end
143
144
 
144
145
  # reduce 3 omitted
@@ -150,19 +151,19 @@ end
150
151
  # reduce 6 omitted
151
152
 
152
153
  def _reduce_7(val, _values)
153
- Group.new(val[1])
154
+ Group.new(val[1])
154
155
  end
155
156
 
156
157
  def _reduce_8(val, _values)
157
- Or.new([val.first, val.last])
158
+ Or.new([val.first, val.last])
158
159
  end
159
160
 
160
161
  def _reduce_9(val, _values)
161
- Or.new([val.first, val.last])
162
+ Or.new([val.first, val.last])
162
163
  end
163
164
 
164
165
  def _reduce_10(val, _values)
165
- Star.new(Symbol.new(val.last))
166
+ Star.new(Symbol.new(val.last))
166
167
  end
167
168
 
168
169
  # reduce 11 omitted
@@ -174,19 +175,19 @@ end
174
175
  # reduce 14 omitted
175
176
 
176
177
  def _reduce_15(val, _values)
177
- Slash.new('/')
178
+ Slash.new(val.first)
178
179
  end
179
180
 
180
181
  def _reduce_16(val, _values)
181
- Symbol.new(val.first)
182
+ Symbol.new(val.first)
182
183
  end
183
184
 
184
185
  def _reduce_17(val, _values)
185
- Literal.new(val.first)
186
+ Literal.new(val.first)
186
187
  end
187
188
 
188
189
  def _reduce_18(val, _values)
189
- Dot.new(val.first)
190
+ Dot.new(val.first)
190
191
  end
191
192
 
192
193
  def _reduce_none(val, _values)