Class: Rake::Delphi::HashTask
- Defined in:
- lib/rake/common/hashtask.rb
Instance Method Summary collapse
- #digest ⇒ Object
-
#initialize(file, alg) ⇒ HashTask
constructor
A new instance of HashTask.
Methods inherited from BasicTask
Constructor Details
#initialize(file, alg) ⇒ HashTask
Returns a new instance of HashTask.
9 10 11 12 |
# File 'lib/rake/common/hashtask.rb', line 9 def initialize(file, alg) @file = file @alg = alg end |
Instance Method Details
#digest ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/rake/common/hashtask.rb', line 14 def digest if ['md5', 'sha1'].include?(@alg) require 'digest/' + @alg return eval("Digest::#{@alg.upcase}.file(@file).hexdigest.upcase") else return "%02X" % Digest::CRC32.file(@file).digest.to_i end end |