module OpenInApp::ControllerHelper
Protected Instance Methods
open_in_app()
click to toggle source
# File lib/open_in_app/controller_helper.rb, line 43 def open_in_app if open_in_app? render(template: 'open_in_app', layout: false) and return false end true end
open_in_app?()
click to toggle source
# File lib/open_in_app/controller_helper.rb, line 25 def open_in_app? open_in_app_device? && open_in_app_supported_request? && open_in_app_url_present? && ( self.class.open_in_app_options[:if].nil? || send(self.class.open_in_app_options[:if]) ) && ( self.class.open_in_app_options[:unless].nil? || !send(self.class.open_in_app_options[:unless]) ) end
open_in_app_device?()
click to toggle source
# File lib/open_in_app/controller_helper.rb, line 9 def open_in_app_device? mobile_device = request.env[Rack::MobileDetect::X_HEADER] !!(mobile_device && %w(iphone ipod).include?(mobile_device.downcase)) end
open_in_app_supported_request?()
click to toggle source
# File lib/open_in_app/controller_helper.rb, line 14 def open_in_app_supported_request? request.get? && !request.xhr? && request.format.html? && params[:_oia].blank? end
open_in_app_url()
click to toggle source
# File lib/open_in_app/controller_helper.rb, line 39 def open_in_app_url nil end
open_in_app_url_present?()
click to toggle source
# File lib/open_in_app/controller_helper.rb, line 21 def open_in_app_url_present? (@open_in_app_url = open_in_app_url).present? end