Class: Watchly::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/watchly/snapshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(targets) ⇒ Snapshot

Returns a new instance of Snapshot.



6
7
8
9
# File 'lib/watchly/snapshot.rb', line 6

def initialize(targets)
  @targets = targets
  @files = capture(targets)
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



3
4
5
# File 'lib/watchly/snapshot.rb', line 3

def files
  @files
end

#targetsObject (readonly) Also known as: globs

Returns the value of attribute targets.



3
4
5
# File 'lib/watchly/snapshot.rb', line 3

def targets
  @targets
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
22
23
# File 'lib/watchly/snapshot.rb', line 19

def ==(other)
  return false unless other.is_a? self.class

  files == other.files
end

#diff(other) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/watchly/snapshot.rb', line 11

def diff(other)
  Changeset.new(
    added:    added_files(other),
    removed:  removed_files(other),
    modified: modified_files(other)
  )
end