Class: Nanoc::Core::Checksummer::RescueUpdateBehavior

Inherits:
UpdateBehavior
  • Object
show all
Defined in:
lib/nanoc/core/checksummer.rb

Class Method Summary collapse

Class Method Details

.update(obj, digest) ⇒ Object



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/nanoc/core/checksummer.rb', line 283

def self.update(obj, digest)
  # rubocop:disable Style/ClassEqualityComparison
  # This Rubocop rule is disabled because the class
  # itself might not be loaded (yet).
  if obj.class.to_s == 'Sass::Importers::Filesystem'
    digest.update('root=')
    digest.update(obj.root)
    return
  end
  # rubocop:enable Style/ClassEqualityComparison

  data =
    begin
      Marshal.dump(obj)
    rescue
      obj.inspect
    end

  digest.update(data)
end