lib/firewall_constraint.rb in firewall_constraint-0.0.5 vs lib/firewall_constraint.rb in firewall_constraint-0.0.6

- old
+ new

@@ -4,15 +4,13 @@ def initialize(ips = []) if ips.respond_to? :call @ips = ips else ips = [ips].flatten - @config = !ips.empty? ? ips : + config = !ips.empty? ? ips : YAML.load_file(Rails.root.join('config','firewall_constraint.yml'))[Rails.env] - - - @ips = @config + @ips = config end end def matches?(request) client_ip = IPAddress::parse(request.env["HTTP_X_FORWARDED_FOR"] ? request.env["HTTP_X_FORWARDED_FOR"] : request.remote_ip) @@ -37,7 +35,11 @@ end def ips @ips.respond_to?(:call) ? @ips.call : @ips end + end + + def self.new(*args) + Constraint.new(*args) end end