module MonitorPage

Constants

VERSION

Attributes

checks[RW]
whitelisted_ips[RW]

Public Class Methods

check(label, &block) click to toggle source
# File lib/monitor_page/engine.rb, line 19
def check(label, &block)
  self.checks += [Proc.new { StatusCheck.create_check(label, &block) }]
end
configure(&block) click to toggle source
# File lib/monitor_page/engine.rb, line 15
def configure &block
  instance_eval(&block)
end
ip_whitelisted?(request_ip) click to toggle source
# File lib/monitor_page/engine.rb, line 29
def ip_whitelisted?(request_ip)
  @whitelisted_ips.inject(false){|res,ip| ip.include?(IPAddr.new(request_ip)) or res }
end
permit(ips) click to toggle source
# File lib/monitor_page/engine.rb, line 23
def permit(ips)
  ip_ranges = ips.is_a?(String) ? ips.split(/,\s?/) : ips

  self.whitelisted_ips = ip_ranges.map{|ip| IPAddr.new(ip) }
end