Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Various improvements.

  • Loading branch information...
commit 2ac6955baff4219512292827169d7cefe2c82536 1 parent 7aae872
@FooBarWidget authored
View
6 lib/auto_redirection/controller_extensions.rb
@@ -41,6 +41,12 @@ def redirection_parameter_for_current_request
return redirection_information_for_current_request.marshal
end
+ def clear_redirection_information
+ # TODO: document and test this
+ @_redirection_information_given = true
+ @_redirection_information = nil
+ end
+
# The current request may contain redirection information.
# If auto-redirection information is given, then this method will redirect
# the HTTP client to that location (by calling +redirect_to+) and return true.
View
6 lib/auto_redirection/redirection_information.rb
@@ -110,6 +110,12 @@ def marshal(encrypt = true, ascii7 = true)
end
end
+ def inspect
+ return sprintf("#<%s:0x%x @controller=%s @action=%s @method=%s\n" <<
+ "@params=%s>", self.class, object_id, controller.inspect,
+ action.inspect, method.inspect, params.inspect)
+ end
+
def ==(other)
return other.is_a?(ControllerRedirectionInformation) &&
other.controller == controller &&
View
9 lib/auto_redirection/view_helpers.rb
@@ -31,6 +31,11 @@ module ViewHelpers
def pass_redirection_information
return render_redirection_information(get_redirection_information)
end
+
+ def save_redirection_information
+ # TODO: document and test this
+ return render_redirection_information(controller.send(:redirection_information_for_current_request))
+ end
private
def get_redirection_information
@@ -48,7 +53,9 @@ def render_redirection_information(info)
html << ">"
if AutoRedirection.debug?
# Value intentionally not escaped.
- html << "\n<!-- #{info.inspect} -->"
+ debug_info = info.inspect
+ debug_info.gsub!('--', '~~')
+ html << "\n<!-- #{debug_info} -->"
end
return html
else
Please sign in to comment.
Something went wrong with that request. Please try again.