From: Martin Hellmich Date: Mon, 18 Feb 2013 15:02:15 +0000 (+0100) Subject: changed .count to .size to support legacy ruby X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=9fa70ae43f14a9b13343ae67ab8d1520f43ebb4d;p=puppet-stdlib.git changed .count to .size to support legacy ruby --- diff --git a/lib/puppet/provider/file_line/ruby.rb b/lib/puppet/provider/file_line/ruby.rb index e21eaa8..a3219d3 100644 --- a/lib/puppet/provider/file_line/ruby.rb +++ b/lib/puppet/provider/file_line/ruby.rb @@ -34,7 +34,7 @@ Puppet::Type.type(:file_line).provide(:ruby) do def handle_create_with_match() regex = resource[:match] ? Regexp.new(resource[:match]) : nil - match_count = lines.select { |l| regex.match(l) }.count + match_count = lines.select { |l| regex.match(l) }.size if match_count > 1 raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'" end