spec/spec_helper.rb in digest-stringbuffer-0.0.2 vs spec/spec_helper.rb in digest-stringbuffer-0.0.3
- old
+ new
@@ -1,15 +1,18 @@
require 'digest/stringbuffer'
-class Test < Digest::StringBuffer
- def initialize
- @prime = 31
- end
+module Digest
+ class Test < StringBuffer
+ def initialize
+ @prime = 31
+ end
- def finish
- result = 0
- buffer.unpack("C*").each do |c|
- result += (c * @prime)
+ def finish
+ result = 0
+ buffer.unpack("C*").each do |c|
+ result += (c * @prime)
+ end
+ [result & 0xffffffff].pack("N")
end
- [result & 0xffffffff].pack("N")
end
end
+include Digest