Skip to content
Browse files

Merge pull request #12892 from akshay-vishnoi/refactor

avoiding next statements
  • Loading branch information...
2 parents 84961dc + dbcd085 commit d4587bab2403bcc8a0c9253e798d984d2fbf1bf5 @rafaelfranca rafaelfranca committed Nov 14, 2013
Showing with 12 additions and 9 deletions.
  1. +12 −9 actionpack/lib/action_dispatch/routing/mapper.rb
View
21 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -147,14 +147,16 @@ def normalize_defaults!
@defaults.merge!(options[:defaults]) if options[:defaults]
options.each do |key, default|
- next if Regexp === default || IGNORE_OPTIONS.include?(key)
- @defaults[key] = default
+ unless Regexp === default || IGNORE_OPTIONS.include?(key)
+ @defaults[key] = default
+ end
end
if options[:constraints].is_a?(Hash)
options[:constraints].each do |key, default|
- next unless URL_OPTIONS.include?(key) && (String === default || Fixnum === default)
- @defaults[key] ||= default
+ if URL_OPTIONS.include?(key) && (String === default || Fixnum === default)
+ @defaults[key] ||= default
+ end
end
end
@@ -169,15 +171,16 @@ def normalize_conditions!
@conditions.merge!(:path_info => path)
constraints.each do |key, condition|
- next if segment_keys.include?(key) || key == :controller
- @conditions[key] = condition
+ unless segment_keys.include?(key) || key == :controller
+ @conditions[key] = condition
+ end
end
@conditions[:required_defaults] = []
options.each do |key, required_default|
- next if segment_keys.include?(key) || IGNORE_OPTIONS.include?(key)
- next if Regexp === required_default
- @conditions[:required_defaults] << key
+ unless segment_keys.include?(key) || IGNORE_OPTIONS.include?(key) || Regexp === required_default
+ @conditions[:required_defaults] << key
+ end
end
via_all = options.delete(:via) if options[:via] == :all

0 comments on commit d4587ba

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