module Detector
Wraps around different detector implementations
Public Class Methods
ifconfig(params)
click to toggle source
# File lib/detectors/detector.rb, line 10 def self.ifconfig(params) return unless params[:type] == 'ifconfig' && params[:version] == 6 Ifconfig.new(params[:network_interface], params[:version]) end
ipify(params)
click to toggle source
# File lib/detectors/detector.rb, line 16 def self.ipify(params) return unless params[:type] == 'ipify' Ipify.new(params[:network_interface], params[:version]) end
ruby_sockets(params)
click to toggle source
# File lib/detectors/detector.rb, line 21 def self.ruby_sockets(params) Ruby.new(params[:version]) if params[:type] == 'ruby' end
setup(params)
click to toggle source
# File lib/detectors/detector.rb, line 3 def self.setup(params) ifconfig(params) || ipify(params) || ruby_sockets(params) || timestamp(params) end
timestamp(params)
click to toggle source
# File lib/detectors/detector.rb, line 25 def self.timestamp(params) Timestamp.new if params[:type] == 'timestamp' end