Sha256: ff2f6879a5226f5c4bebbe98f76fcc40e555b159576479b26b6b7515c65fe5ce
Contents?: true
Size: 856 Bytes
Versions: 2
Compression:
Stored size: 856 Bytes
Contents
module JumpBack class PathFinder attr_reader :path def initialize(request, path, options) @uri = Urls.uri(request.env["HTTP_REFERER"]) @path = determine_path(request, path, options) end def redirect_back?(request, options) has_referer?(request) ? is_local?(request, options) ? true : false : false end def has_referer?(request) !request.env["HTTP_REFERER"].blank? and request.env["HTTP_REFERER"] != request.env["REQUEST_URI"] end def is_local?(request, options) return true if options[:offsite] !(host && host != request.host) end private attr_reader :uri def determine_path(request, path, options) redirect_back?(request, options) ? :back : path end def host uri.host if uri end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jump_back-0.3.2 | lib/jump_back/path_finder.rb |
jump_back-0.3.1 | lib/jump_back/path_finder.rb |