Class: Dotsync::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/dotsync/models/diff.rb

Overview

Represents the differences between two directories

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(additions: [], modifications: [], removals: [], modification_pairs: [], removal_rel_paths: []) ⇒ Diff

Returns a new instance of Diff.



8
9
10
11
12
13
14
# File 'lib/dotsync/models/diff.rb', line 8

def initialize(additions: [], modifications: [], removals: [], modification_pairs: [], removal_rel_paths: [])
  @additions = additions
  @modifications = modifications
  @removals = removals
  @modification_pairs = modification_pairs
  @removal_rel_paths = removal_rel_paths
end

Instance Attribute Details

#additionsObject (readonly)

Returns the value of attribute additions.



6
7
8
# File 'lib/dotsync/models/diff.rb', line 6

def additions
  @additions
end

#modification_pairsObject (readonly)

Returns the value of attribute modification_pairs.



6
7
8
# File 'lib/dotsync/models/diff.rb', line 6

def modification_pairs
  @modification_pairs
end

#modificationsObject (readonly)

Returns the value of attribute modifications.



6
7
8
# File 'lib/dotsync/models/diff.rb', line 6

def modifications
  @modifications
end

#removal_rel_pathsObject (readonly)

Returns the value of attribute removal_rel_paths.



6
7
8
# File 'lib/dotsync/models/diff.rb', line 6

def removal_rel_paths
  @removal_rel_paths
end

#removalsObject (readonly)

Returns the value of attribute removals.



6
7
8
# File 'lib/dotsync/models/diff.rb', line 6

def removals
  @removals
end

Instance Method Details

#any?Boolean

Returns:



16
17
18
# File 'lib/dotsync/models/diff.rb', line 16

def any?
  @additions.any? || @modifications.any? || @removals.any?
end

#empty?Boolean

Returns:



20
21
22
# File 'lib/dotsync/models/diff.rb', line 20

def empty?
  @additions.empty? && @modifications.empty? && @removals.empty?
end