Class: Kicker::FSEvents::FSEvent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FSEvent

Returns a new instance of FSEvent.



10
11
12
# File 'lib/kicker/fsevents.rb', line 10

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#filesObject



14
15
16
17
18
19
20
21
22
# File 'lib/kicker/fsevents.rb', line 14

def files
  Dir.glob("#{File.expand_path(path)}/*").map do |filename|
    begin
      [File.mtime(filename), filename]
    rescue Errno::ENOENT
      nil
    end
  end.compact.sort.reverse.map { |_, filename| filename }
end