Module: GetText::Reloader::Stat

Defined in:
lib/rack/gettext_reloader.rb

Instance Method Summary collapse

Instance Method Details

#rotationObject



45
46
47
48
49
50
51
52
# File 'lib/rack/gettext_reloader.rb', line 45

def rotation
  @po.map{|file|
    found, stat = safe_stat(file)
    next unless found and stat and mtime = stat.mtime
    @cache[file] = found
    yield(found, mtime)
  }.compact
end

#safe_stat(file) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/rack/gettext_reloader.rb', line 54

def safe_stat(file)
  return unless file
  stat = ::File.stat(file)
  return file, stat if stat.file?
rescue Errno::ENOENT, Errno::ENOTDIR
  @cache.delete(file) and false
end