Sha256: 61441ae9c5b45c909e4320c3a2c3714d42673096c80d4295c8f26a33a57fbccc

Contents?: true

Size: 710 Bytes

Versions: 5

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

module Masks
  module Sessions
    # Session for masking +ActionDispatch::Request+ and +Rack::Request+.
    class Request < Masks::Session
      attribute :request

      def to_s
        "mask(#{request.method.upcase} #{request.path})"
      end

      def ip_address
        request.remote_ip
      end

      def user_agent
        request.user_agent
      end

      def fingerprint
        params[:_fingerprint]
      end

      def params
        request.params
      end

      def data
        request.session
      end

      def matches_mask?(mask)
        mask.matches_request?(request)
      end

      def writable?
        request.post?
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 app/models/masks/sessions/request.rb
masks-0.3.2 app/models/masks/sessions/request.rb
masks-0.3.1 app/models/masks/sessions/request.rb
masks-0.3.0 app/models/masks/sessions/request.rb
masks-0.2.0 app/models/masks/sessions/request.rb