Class: Vagrant::Util::Directory

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

Class Method Summary collapse

Class Method Details

.directory_changed?(dir_path, threshold_time) ⇒ Boolean

Check if directory has any new updates

Parameters:

  • Path (Pathname, String)

    to directory

  • time (Time)

    to compare to eg. has any file in dir_path changed since this time

Returns:

  • (Boolean)

12
13
14
15
16
# File 'lib/vagrant/util/directory.rb', line 12

def self.directory_changed?(dir_path, threshold_time)
  Dir.glob(Pathname.new(dir_path).join("**", "*")).any? do |path|
    Pathname.new(path).mtime > threshold_time
  end
end