Skip to content
This repository
Browse code

avoiding next statements

  • Loading branch information...
commit dbcd0850136d3b27532e5699b23c78ca7965e670 1 parent fdf36d8
Akshay Vishnoi authored November 15, 2013
21  actionpack/lib/action_dispatch/routing/mapper.rb
@@ -147,14 +147,16 @@ def normalize_defaults!
147 147
             @defaults.merge!(options[:defaults]) if options[:defaults]
148 148
 
149 149
             options.each do |key, default|
150  
-              next if Regexp === default || IGNORE_OPTIONS.include?(key)
151  
-              @defaults[key] = default
  150
+              unless Regexp === default || IGNORE_OPTIONS.include?(key)
  151
+                @defaults[key] = default
  152
+              end
152 153
             end
153 154
 
154 155
             if options[:constraints].is_a?(Hash)
155 156
               options[:constraints].each do |key, default|
156  
-                next unless URL_OPTIONS.include?(key) && (String === default || Fixnum === default)
157  
-                @defaults[key] ||= default
  157
+                if URL_OPTIONS.include?(key) && (String === default || Fixnum === default)
  158
+                  @defaults[key] ||= default
  159
+                end
158 160
               end
159 161
             end
160 162
 
@@ -169,15 +171,16 @@ def normalize_conditions!
169 171
             @conditions.merge!(:path_info => path)
170 172
 
171 173
             constraints.each do |key, condition|
172  
-              next if segment_keys.include?(key) || key == :controller
173  
-              @conditions[key] = condition
  174
+              unless segment_keys.include?(key) || key == :controller
  175
+                @conditions[key] = condition
  176
+              end
174 177
             end
175 178
 
176 179
             @conditions[:required_defaults] = []
177 180
             options.each do |key, required_default|
178  
-              next if segment_keys.include?(key) || IGNORE_OPTIONS.include?(key)
179  
-              next if Regexp === required_default
180  
-              @conditions[:required_defaults] << key
  181
+              unless segment_keys.include?(key) || IGNORE_OPTIONS.include?(key) || Regexp === required_default
  182
+                @conditions[:required_defaults] << key
  183
+              end
181 184
             end
182 185
 
183 186
             via_all = options.delete(:via) if options[:via] == :all

0 notes on commit dbcd085

Please sign in to comment.
Something went wrong with that request. Please try again.