Class: Listen::File

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ File

Returns a new instance of File.



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

def initialize(path)
  @path = path
  @data = { type: 'File' }
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



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

def data
  @data
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#changeObject



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

def change
  if _existing_path? && _modified?
    _set_record_data
    :modified
  elsif _new_path?
    _set_record_data
    :added
  elsif _removed_path?
    _unset_record_data
    :removed
  end
end