Sha256: cb51a98fba53cfe713d9c9c9bfd20b2c647384b0f257120a35386dbaa79b2af9

Contents?: true

Size: 337 Bytes

Versions: 1

Compression:

Stored size: 337 Bytes

Contents

module IpAnonymizer
  class HashIp
    def initialize(app, key:)
      @app = app
      @key = key
    end

    def call(env)
      req = ActionDispatch::Request.new(env)
      # TODO lazy load, like ActionDispatch::RemoteIp
      req.remote_ip = IpAnonymizer.hash_ip(req.remote_ip, key: @key)
      @app.call(req.env)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ip_anonymizer-0.1.0 lib/ip_anonymizer/hash_ip.rb