Class: Ace::Support::Models::Atoms::FileReader
- Inherits:
-
Object
- Object
- Ace::Support::Models::Atoms::FileReader
- Defined in:
- lib/ace/support/models/atoms/file_reader.rb
Overview
Reads files from the cache
Class Method Summary collapse
-
.exist?(path) ⇒ Boolean
Check if file exists.
-
.mtime(path) ⇒ Time?
Get file modification time.
-
.read(path) ⇒ String?
Read file contents.
Class Method Details
.exist?(path) ⇒ Boolean
Check if file exists
26 27 28 |
# File 'lib/ace/support/models/atoms/file_reader.rb', line 26 def exist?(path) File.exist?(path) end |
.mtime(path) ⇒ Time?
Get file modification time
33 34 35 36 37 |
# File 'lib/ace/support/models/atoms/file_reader.rb', line 33 def mtime(path) return nil unless File.exist?(path) File.mtime(path) end |
.read(path) ⇒ String?
Read file contents
13 14 15 16 17 18 19 20 21 |
# File 'lib/ace/support/models/atoms/file_reader.rb', line 13 def read(path) return nil unless File.exist?(path) File.read(path) rescue Errno::EACCES => e raise CacheError, "Permission denied reading #{path}: #{e.}" rescue Errno::ENOENT nil end |