135: def getsum(checktype, file = nil)
136: sum = ""
137:
138: checktype = :mtime if checktype == :timestamp
139: checktype = :ctime if checktype == :time
140: self.should = checktype = :md5 if @resource.property(:source)
141:
142: file ||= @resource[:path]
143:
144: return nil unless FileTest.exist?(file)
145:
146: if ! FileTest.file?(file)
147: checktype = :mtime
148: end
149: method = checktype.to_s + "_file"
150:
151: self.fail("Invalid checksum type %s" % checktype) unless respond_to?(method)
152:
153: return "{%s}%s" % [checktype, send(method, file)]
154: end