From: Jonathan Boyett Date: Mon, 11 Jul 2011 17:19:07 +0000 (-0700) Subject: replace String#lines with a String#split to ensure compatibility with Ruby 1.8.5 X-Git-Tag: v0.0.1~23 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a7faff6f5b0de882bc720c8eb652d37b85a6b2a8;p=puppet-modules%2Fpuppetlabs-firewall.git replace String#lines with a String#split to ensure compatibility with Ruby 1.8.5 --- diff --git a/lib/puppet/provider/firewall/iptables.rb b/lib/puppet/provider/firewall/iptables.rb index 7e87e14..84238a8 100644 --- a/lib/puppet/provider/firewall/iptables.rb +++ b/lib/puppet/provider/firewall/iptables.rb @@ -72,10 +72,12 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir table = nil rules = [] counter = 1 - iptables_save.lines do |line| + + # String#lines would be nice, but we need to support Ruby 1.8.5 + iptables_save.split("\n").each do |line| unless line =~ /^\#\s+|^\:\S+|^COMMIT/ if line =~ /^\*/ - table = line.sub(/\*/, "").chomp! + table = line.sub(/\*/, "") else if hash = rule_to_hash(line, table, counter) rules << new(hash)