Sha256: 99603fe0870e4adc302f20c3a2d740b4dfaef2e2fd5264fb4346322d298e680a

Contents?: true

Size: 480 Bytes

Versions: 1

Compression:

Stored size: 480 Bytes

Contents

module Rack
  module Schmobile
    module Request
      def is_mobile?
        unless defined?(@is_mobile)
          @is_mobile = Rack::Schmobile::Filters.apply(self)
        end

        @is_mobile
      end

      def toggle_mobile_session!
        session[Rack::Schmobile::IS_MOBILE] = !is_mobile?
      end

      def is_device?(identifier)
        user_agent =~ /#{identifier}/i
      end
    end
  end
end

Rack::Request.class_eval do
  include Rack::Schmobile::Request
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schmobile-0.3.0 lib/rack/schmobile/request_extension.rb