Module: Bonobot::Fingerprint
- Includes:
- Configuration
- Defined in:
- lib/bonobot/fingerprint.rb
Constant Summary collapse
- ALGORITHM =
{ "md5" => Digest::MD5, "sha1" => Digest::SHA1, "sha256" => Digest::SHA256 }.freeze
Class Method Summary collapse
Methods included from Configuration
Class Method Details
.algorithm ⇒ Object
22 23 24 |
# File 'lib/bonobot/fingerprint.rb', line 22 def self.algorithm ALGORITHM.fetch(configuration.fingerprint_algorithm, Digest::MD5) end |
.calculate(path) ⇒ Object
10 11 12 |
# File 'lib/bonobot/fingerprint.rb', line 10 def self.calculate(path) algorithm.send(method, File.read(path)) end |
.method ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/bonobot/fingerprint.rb', line 14 def self.method if configuration.fingerprint_human_readable :bubblebabble else :hexdigest end end |