class IpAnonymizer::MaskIp

Public Class Methods

new(app) click to toggle source
# File lib/ip_anonymizer/mask_ip.rb, line 3
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/ip_anonymizer/mask_ip.rb, line 7
def call(env)
  req = ActionDispatch::Request.new(env)
  # get header directly to preserve ActionDispatch::RemoteIp lazy loading
  req.remote_ip = GetIp.new(req.get_header("action_dispatch.remote_ip".freeze))
  @app.call(req.env)
end