Class: PhusionPassenger::Utils::FileSystemWatcher::FileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/phusion_passenger/utils/file_system_watcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename, stat) ⇒ FileInfo

Returns a new instance of FileInfo.



160
161
162
163
# File 'lib/phusion_passenger/utils/file_system_watcher.rb', line 160

def initialize(filename, stat)
	@filename = filename
	@stat = stat
end

Instance Method Details

#changed?(check_mtime = true) ⇒ Boolean

Returns:

  • (Boolean)


165
166
167
168
169
170
171
172
173
174
175
# File 'lib/phusion_passenger/utils/file_system_watcher.rb', line 165

def changed?(check_mtime = true)
	new_stat = File.stat(@filename)
	if check_mtime
		mtime_changed = @stat.mtime != new_stat.mtime || @stat.size != new_stat.size
	else
		mtime_changed = false
	end
	return @stat.ino != new_stat.ino || @stat.ftype != new_stat.ftype || mtime_changed
rescue Errno::EACCES, Errno::ENOENT
	return true
end