Class: Listen::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/listen/directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ Directory

Returns a new instance of Directory.



5
6
7
8
# File 'lib/listen/directory.rb', line 5

def initialize(path, options = {})
  @path    = path
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/listen/directory.rb', line 3

def options
  @options
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/listen/directory.rb', line 3

def path
  @path
end

Instance Method Details

#scanObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/listen/directory.rb', line 10

def scan
  _update_record
  _all_entries.each do |entry_path, data|
    case data[:type]
    when 'File' then _async_change(entry_path, options.merge(type: 'File'))
    when 'Dir'
      _async_change(entry_path, options.merge(type: 'Dir')) if _recursive_scan?(entry_path)
    end
  end
end