summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-03-16 09:05:02 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit44cba9cfb85a43f758c457bf3a5e661706f1e8f3 (patch)
treeaac6ed83ab671bd07d91e8cfd9235d89688887c3 /lib/puppet
parentd05d25c3fd1c3472060504edfa4fa3037bdd9781 (diff)
downloadpuppet-44cba9cfb85a43f758c457bf3a5e661706f1e8f3.tar.gz
puppet-44cba9cfb85a43f758c457bf3a5e661706f1e8f3.tar.xz
puppet-44cba9cfb85a43f758c457bf3a5e661706f1e8f3.zip
Adding "checksum?" helper method to Checksums module
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/util/checksums.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb
index 39477ee2b..f68f77624 100644
--- a/lib/puppet/util/checksums.rb
+++ b/lib/puppet/util/checksums.rb
@@ -1,6 +1,11 @@
# A stand-alone module for calculating checksums
# in a generic way.
module Puppet::Util::Checksums
+ # Is the provided string a checksum?
+ def checksum?(string)
+ string =~ /^\{(\w{3,5})\}\S+/
+ end
+
# Strip the checksum type from an existing checksum
def sumtype(checksum)
if checksum =~ /^\{(\w+)\}/