Sha256: 7039525fd24071219ada4f9803d7f3fa5cd00efe2c79ad8c04bd7db581c55651
Contents?: true
Size: 889 Bytes
Versions: 7
Compression:
Stored size: 889 Bytes
Contents
module Idonethis::Adapters module IO module DirectoryInfo class << self def modified_today?(dir) return [] unless File.exists?(dir) now = Time.now _in(dir).select{|it| any_file_inside_changed?(it, now) } end private def any_file_inside_changed?(dir, now) Dir["#{dir}/**/**"].each do |file| return true if today?(File.ctime(file), now) end return false end def today?(time, now) time.year == now.year && time.month == now.month && time.day == now.day end def _in(dir) Dir.entries(dir). reject{|it| ["..", "."].include?(it) }. select{|it| File.directory?(File.join(dir, it))}. map{ |it| File.expand_path(File.join(dir, it))} end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems