Class: Coyote::FSListeners::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/coyote/fs_listeners/base.rb

Direct Known Subclasses

Darwin, Linux, Polling, Windows

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



7
8
9
10
# File 'lib/coyote/fs_listeners/base.rb', line 7

def initialize
  @sha1_checksums_hash = {}
  update_last_event
end

Instance Attribute Details

#last_eventObject (readonly)

Returns the value of attribute last_event.



5
6
7
# File 'lib/coyote/fs_listeners/base.rb', line 5

def last_event
  @last_event
end

#sha1_checksums_hashObject (readonly)

Returns the value of attribute sha1_checksums_hash.



5
6
7
# File 'lib/coyote/fs_listeners/base.rb', line 5

def sha1_checksums_hash
  @sha1_checksums_hash
end

Instance Method Details

#modified_files(dirs, options = {}) ⇒ Object



16
17
18
19
# File 'lib/coyote/fs_listeners/base.rb', line 16

def modified_files(dirs, options = {})
  files = potentially_modified_files(dirs, options).select { |path| File.file?(path) && file_modified?(path) && file_content_modified?(path) }
  files.map! { |file| file.gsub("#{Dir.pwd}/", '') }
end

#update_last_eventObject



12
13
14
# File 'lib/coyote/fs_listeners/base.rb', line 12

def update_last_event
  @last_event = Time.now
end