From f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 5 Nov 2008 17:49:36 -0600 Subject: Adding a method to Checksums to extract the sum type Signed-off-by: Luke Kanies --- lib/puppet/util/checksums.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb index 15d2eadd1..4b51789f6 100644 --- a/lib/puppet/util/checksums.rb +++ b/lib/puppet/util/checksums.rb @@ -1,6 +1,15 @@ # A stand-alone module for calculating checksums # in a generic way. module Puppet::Util::Checksums + # Strip the checksum type from an existing checksum + def sumtype(checksum) + if checksum =~ /^\{(\w+)\}/ + return $1 + else + return nil + end + end + # Calculate a checksum using Digest::MD5. def md5(content) require 'digest/md5' -- cgit