module RequestInfo

© Copyright 2017 Ribose Inc.

Detects IP related information

© Copyright 2017 Ribose Inc.

Use an OpenStruct to simplify results setting and handling

© Copyright 2017 Ribose Inc.

Constants

CONFIGURATION_MUTEX
VERSION

Public Class Methods

configuration() click to toggle source
# File lib/request_info.rb, line 38
def configuration
  configure if @configuration.nil?
  @configuration
end
configure() { |mutable_configuration| ... } click to toggle source
# File lib/request_info.rb, line 29
def configure
  CONFIGURATION_MUTEX.synchronize do
    @mutable_configuration ||= Configuration.new
    yield @mutable_configuration if block_given?
    @configuration = @mutable_configuration.dup.tap(&:freeze)
  end
  nil
end
preload() click to toggle source
# File lib/request_info.rb, line 43
def preload
  GeoIP.instance
end
results() click to toggle source

Get detection results

# File lib/request_info.rb, line 19
def results
  Thread.current[:request_info_results] ||=
    RequestInfo::Results.new
end
results=(value) click to toggle source

Set results

# File lib/request_info.rb, line 25
def results=(value)
  Thread.current[:request_info_results] = value
end