lib/simple_navigation.rb in simple-navigation-2.7.0 vs lib/simple_navigation.rb in simple-navigation-2.7.1
- old
+ new
@@ -147,9 +147,23 @@
#
def register_renderer(renderer_hash)
self.registered_renderers.merge!(renderer_hash)
end
+ # Returns the current request.
+ #
+ def request
+ SimpleNavigation.template.request if SimpleNavigation.template
+ end
+
+ # Returns the current request's URI.
+ #
+ def request_uri
+ return '' unless SimpleNavigation.request
+ return SimpleNavigation.request.fullpath if SimpleNavigation.request.respond_to?(:fullpath)
+ SimpleNavigation.request.request_uri
+ end
+
private
# TODO: refactor this ugly thing to make it nice and short
def parse_explicit_navigation_args