Class: Kaisoku::Checksum

Inherits:
Object
  • Object
show all
Defined in:
lib/kaisoku/checksum.rb

Constant Summary collapse

RUBY_EXTENSION =
'.rb'
SKIPPED_RUBY_TOKENS =
%i[COMMENT IGNORED_NEWLINE NEWLINE].freeze

Instance Method Summary collapse

Instance Method Details

#digest(path) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kaisoku/checksum.rb', line 11

def digest(path)
  return nil unless File.file?(path)

  if File.extname(path) == RUBY_EXTENSION
    ruby_digest(path)
  else
    raw_digest(path)
  end
rescue StandardError
  raw_digest(path)
end