class NotFoundCatcher::RequestParser
Public Instance Methods
build_redirect(request)
click to toggle source
# File lib/not_found_catcher/request_parser.rb, line 9 def build_redirect(request) request.fullpath.gsub(Regexp.new(self.role),self.redirect.gsub(/\$([0-9]+)/,'$$$1').gsub('$$$','\\')) end
considered?()
click to toggle source
# File lib/not_found_catcher/request_parser.rb, line 5 def considered? !redirect.blank? end
destroy()
click to toggle source
# File lib/not_found_catcher/request_parser.rb, line 47 def destroy store = NotFoundCatcher.request_store.store store.transaction do store.delete(self.role) end end
id()
click to toggle source
# File lib/not_found_catcher/request_parser.rb, line 43 def id Digest::MD5.hexdigest(self.role) end
model()
click to toggle source
Return the relative model for this record
# File lib/not_found_catcher/request_parser.rb, line 17 def model r = Role.new( role: self.role, http_method: self.method, redirect: self.redirect ) r.request_parser = self r end
save()
click to toggle source
Cerca se stesso all'interno dello store e si salva
# File lib/not_found_catcher/request_parser.rb, line 32 def save store = NotFoundCatcher.request_store.store store.transaction do store[self.role] = self end end