Class: Eco::Data::Locations::NodeDiff

Inherits:
Hashes::DiffResult show all
Includes:
Accessors
Defined in:
lib/eco/data/locations/node_diff.rb,
lib/eco/data/locations/node_diff/accessors.rb,
lib/eco/data/locations/node_diff/selectors.rb,
lib/eco/data/locations/node_diff/nodes_diff.rb

Overview

Note:

this works with Hash object where basic keys are:

  • nodeId
  • name
  • parentId
  • archived
Note:

other properties can be part of the Hash although they may not influence the results.

Differences between node before and after

Defined Under Namespace

Modules: Accessors, Selectors Classes: NodesDiff

Constant Summary

Constants included from Language::Models::ClassHelpers

Language::Models::ClassHelpers::NOT_USED

Instance Attribute Summary

Attributes inherited from Hashes::DiffResult

#src1, #src2

Instance Method Summary collapse

Methods inherited from Hashes::DiffResult

#attr, #attr_prev, #case_sensitive?, #comparable_attrs, #compared_attrs, #del?, #diff?, #diff_attr?, #diff_attrs, #diff_hash, #dup, #eq?, #initialize, #key, #key?, #new?, #update?

Methods included from Language::Models::ClassHelpers

#class_resolver, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #redef_without_warning, #resolve_class, #to_constant, #used_param?

Constructor Details

This class inherits a constructor from Eco::Data::Hashes::DiffResult

Instance Method Details

#archive?Boolean

Has the archived property changed and it was false?

Returns:

  • (Boolean)


51
52
53
# File 'lib/eco/data/locations/node_diff.rb', line 51

def archive?
  !prev_archived && (del? || archived)
end

#diff_name?Boolean Also known as: name?, id?

Has the property name changed?

Returns:

  • (Boolean)


27
28
29
# File 'lib/eco/data/locations/node_diff.rb', line 27

def diff_name?
  diff_name_src? && update?
end

#diff_name_src?Object



25
# File 'lib/eco/data/locations/node_diff.rb', line 25

alias_method :diff_name_src?, :diff_name?

#id_name?Boolean

Has any of id or name properties changed?

Returns:

  • (Boolean)


36
37
38
# File 'lib/eco/data/locations/node_diff.rb', line 36

def id_name?
  id? || diff_name?
end

#move?Boolean

Has the parent id changed?

Returns:

  • (Boolean)


41
42
43
# File 'lib/eco/data/locations/node_diff.rb', line 41

def move?
  update? && diff_parentId?
end

#unarchive?Boolean

Has the archived property changed and it was true?

Returns:

  • (Boolean)


46
47
48
# File 'lib/eco/data/locations/node_diff.rb', line 46

def unarchive?
  !archived && update? && diff_archived?
end