Class: Moab::FileInstanceDifference

Inherits:
Serializer::Serializable show all
Includes:
HappyMapper
Defined in:
lib/moab/file_instance_difference.rb

Overview

Note:

Copyright © 2012 by The Board of Trustees of the Leland Stanford Junior University. All rights reserved. See LICENSE for details.

A container for recording difference information at the file level

  • If there was no change, the change type is set to identical

  • If the signature is unchanged, but the path has moved, the change type is set to renamed

  • If path is unchanged, but the signature has changed, the change type is set to modified and

both signatures are reported
  • If the signature and path are only in the basis inventory, the change type is set to deleted

  • If the signature and path are only in the other inventory, the change type is set to added

This is a child element of FileGroupDifferenceSubset, which is in turn a descendent of FileInventoryDifference, the documentation of which contains a full example

Data Model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Serializer::Serializable

#array_to_hash, deep_diff, #diff, #key, #key_name, #summary, #to_hash, #to_json, #to_yaml, #variable_names, #variables

Constructor Details

#initialize(opts = {}) ⇒ FileInstanceDifference

Returns a new instance of FileInstanceDifference.



28
29
30
31
# File 'lib/moab/file_instance_difference.rb', line 28

def initialize(opts = {})
  @signatures = []
  super(opts)
end

Instance Attribute Details

#basis_pathString

Returns The file’s path in the basis inventory (usually for an old version).

Returns:

  • (String)

    The file’s path in the basis inventory (usually for an old version)



39
# File 'lib/moab/file_instance_difference.rb', line 39

attribute :basis_path, String, :tag => 'basisPath', :on_save => proc { |s| s.to_s }

#changeString

Returns The type of file change.

Returns:

  • (String)

    The type of file change



35
# File 'lib/moab/file_instance_difference.rb', line 35

attribute :change, String

#other_pathString

Returns The file’s path in the other inventory (usually for an new version) compared against the basis.

Returns:

  • (String)

    The file’s path in the other inventory (usually for an new version) compared against the basis



43
# File 'lib/moab/file_instance_difference.rb', line 43

attribute :other_path, String, :tag => 'otherPath', :on_save => proc { |s| s.to_s }

#signaturesArray<FileSignature>

Returns The fixity data of the file manifestation(s) (plural if change was a content modification).

Returns:

  • (Array<FileSignature>)

    The fixity data of the file manifestation(s) (plural if change was a content modification)



47
# File 'lib/moab/file_instance_difference.rb', line 47

has_many :signatures, FileSignature, :tag => 'fileSignature'