class Voltron::Config::Defender

Attributes

enabled[RW]
ip_restrict_errors[RW]
ips[RW]
slack_api_token[RW]
slack_channel[RW]
trello_board[RW]
trello_key[RW]
trello_token[RW]

Public Class Methods

new() click to toggle source
# File lib/voltron/config/defender.rb, line 12
def initialize
  @enabled ||= false
  @ip_restrict_errors ||= true
  @ips ||= []
end

Public Instance Methods

enabled?() click to toggle source
# File lib/voltron/config/defender.rb, line 18
def enabled?
  enabled == true
end
has_ip?(ip) click to toggle source
# File lib/voltron/config/defender.rb, line 22
def has_ip?(ip)
  return false if ip.blank?

  candidates = [ips].flatten.compact
  
  candidates.each do |candidate|
    if candidate.is_a?(Regexp)
      return true if candidate =~ ip.to_s
    else
      return true if candidate.to_s == ip.to_s
    end
  end

  false
end