Sha256: 94ac1031740c129a2a2ebc4751fc09cd36f4e2be057c96409fed5f88883de36f

Contents?: true

Size: 773 Bytes

Versions: 8

Compression:

Stored size: 773 Bytes

Contents

require "rack/request"

module Galakei
  module Request
    def docomo?
      /DoCoMo/i =~ user_agent
    end

    def au?
      # doesn't detect some 2G phones, but as they will be discontinued soon, doesn't really matter
      /KDDI/ =~ user_agent
    end

    def softbank?
      /^(SoftBank|Vodafone)/ =~ user_agent
    end

    def imode_browser_1_0?
      if /docomo(.*\((.*;)?c(\d+)\;)?/i =~ user_agent
        $3.to_i < 500
      else
        false
      end
    end

    def au_browser_6?
      /KDDI.* UP\.Browser\/6\./ =~ user_agent && /UP\.Browser\/6\.2_7/ !~ user_agent
    end

    def different_cookie_in_ssl?
      au? || softbank?
    end

    def galakei?
      docomo? || au? || softbank?
    end
  end
end

Rack::Request.send :include, Galakei::Request

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
galakei-0.7.3 lib/galakei/request.rb
galakei-0.7.2 lib/galakei/request.rb
galakei-0.7.1 lib/galakei/request.rb
galakei-0.7.0 lib/galakei/request.rb
galakei-0.6.6 lib/galakei/request.rb
galakei-0.6.5 lib/galakei/request.rb
galakei-0.6.4 lib/galakei/request.rb
galakei-0.6.3 lib/galakei/request.rb