Sha256: 82489cdcbac1f10387b85b1b750b4b12bc02dfc98523412035153e12d4bf16ef

Contents?: true

Size: 807 Bytes

Versions: 13

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true
module ThinkFeelDoEngine
  module Concerns
    # Methods for browser type detection.
    module BrowserDetective
      extend ActiveSupport::Concern

      private

      # See http://richonrails.com/articles/action-pack-variants-in-rails-4-1
      def detect_browser
        request.variant = case request.user_agent
                          when /iPad/i
                            :tablet
                          when /iPhone|Windows Phone/i
                            :phone
                          when /Android/i && /mobile/i
                            :phone
                          when /Android/i
                            :tablet
                          else
                            :desktop
                          end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.8 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.7 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.6 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.5 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.4 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.2 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.1 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.22.0 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.21.2 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.21.1 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.21.0 app/controllers/think_feel_do_engine/concerns/browser_detective.rb
think_feel_do_engine-3.20.1 app/controllers/think_feel_do_engine/concerns/browser_detective.rb