Class: Nanoc::Core::Checksummer::DocumentUpdateBehavior

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

Class Method Summary collapse

Class Method Details

.update(obj, digest) ⇒ Object



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/nanoc/core/checksummer.rb', line 231

def self.update(obj, digest)
  if obj.checksum_data
    digest.update('checksum_data=' + obj.checksum_data)
  else
    if obj.content_checksum_data
      digest.update('content_checksum_data=' + obj.content_checksum_data)
    else
      digest.update('content=')
      yield(obj.content)
    end

    if obj.attributes_checksum_data
      digest.update(',attributes_checksum_data=' + obj.attributes_checksum_data)
    else
      digest.update(',attributes=')
      yield(obj.attributes)
    end

    digest.update(',identifier=')
    yield(obj.identifier)
  end
end