Class: Rucola::FSEvents::FSEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/vendor/fssm/fsevents.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fsevents_object, id, path) ⇒ FSEvent

Returns a new instance of FSEvent.



9
10
11
# File 'lib/vendor/fssm/fsevents.rb', line 9

def initialize(fsevents_object, id, path)
  @fsevents_object, @id, @path = fsevents_object, id, path
end

Instance Attribute Details

#fsevents_objectObject (readonly)

Returns the value of attribute fsevents_object.



6
7
8
# File 'lib/vendor/fssm/fsevents.rb', line 6

def fsevents_object
  @fsevents_object
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/vendor/fssm/fsevents.rb', line 7

def id
  @id
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/vendor/fssm/fsevents.rb', line 8

def path
  @path
end

Instance Method Details

#filesObject

Returns an array of the files/dirs in the path that the event occurred in. The files are sorted by the modification time, the first entry is the last modified file.



15
16
17
# File 'lib/vendor/fssm/fsevents.rb', line 15

def files
  Dir.glob("#{File.expand_path(path)}/*").sort_by {|f| File.mtime(f) }.reverse
end

#last_modified_fileObject

Returns the last modified file in the path that the event occurred in.



20
21
22
# File 'lib/vendor/fssm/fsevents.rb', line 20

def last_modified_file
  files.first
end