Class: Filetter::FileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/filetter/file_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pathname, observe_targets = [:mtime]) ⇒ FileInfo

Returns a new instance of FileInfo.



7
8
9
10
11
12
13
# File 'lib/filetter/file_info.rb', line 7

def initialize(pathname, observe_targets = [:mtime])
  @changes = []
  @pathname = pathname
  @targets = {}
  @observe_targets = observe_targets
  update_status()
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



5
6
7
# File 'lib/filetter/file_info.rb', line 5

def changes
  @changes
end

#pathnameObject (readonly)

Returns the value of attribute pathname.



5
6
7
# File 'lib/filetter/file_info.rb', line 5

def pathname
  @pathname
end

Instance Method Details

#check_modifiedObject



15
16
17
18
19
20
21
22
# File 'lib/filetter/file_info.rb', line 15

def check_modified
  old = @targets.dup
  update_status()
  @changes = []
  @targets.each do |k, v|
    @changes << k unless old[k] == v
  end
end