vendor/rails/actionpack/lib/action_controller/routing/route.rb in radiant-0.9.1 vs vendor/rails/actionpack/lib/action_controller/routing/route.rb in radiant-1.0.0.rc1

- old
+ new

@@ -63,31 +63,31 @@ # For example, +{:controller => 'pages', :action => 'show'} is the shell for the route: # # map.connect '/page/:id', :controller => 'pages', :action => 'show', :id => /\d+/ # def parameter_shell - @parameter_shell ||= returning({}) do |shell| + @parameter_shell ||= {}.tap do |shell| requirements.each do |key, requirement| shell[key] = requirement unless requirement.is_a? Regexp end end end # Return an array containing all the keys that are used in this route. This # includes keys that appear inside the path, and keys that have requirements # placed upon them. def significant_keys - @significant_keys ||= returning([]) do |sk| + @significant_keys ||= [].tap do |sk| segments.each { |segment| sk << segment.key if segment.respond_to? :key } sk.concat requirements.keys sk.uniq! end end # Return a hash of key/value pairs representing the keys in the route that # have defaults, or which are specified by non-regexp requirements. def defaults - @defaults ||= returning({}) do |hash| + @defaults ||= {}.tap do |hash| segments.each do |segment| next unless segment.respond_to? :default hash[segment.key] = segment.default unless segment.default.nil? end requirements.each do |key,req|