Class: Refi::FileCache
- Inherits:
-
Object
- Object
- Refi::FileCache
- Defined in:
- lib/file_cache_refi.rb
Instance Method Summary collapse
- #get_text(file_pn) ⇒ Object
-
#initialize ⇒ FileCache
constructor
A new instance of FileCache.
Constructor Details
#initialize ⇒ FileCache
Returns a new instance of FileCache.
6 7 8 |
# File 'lib/file_cache_refi.rb', line 6 def initialize @open_files = {} end |
Instance Method Details
#get_text(file_pn) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/file_cache_refi.rb', line 9 def get_text(file_pn) if @open_files[file_pn] == nil $Log.tlog({id: 'newline'}) #dput #dputi "reading file: #{$st[:txt_file]}#{file_pn} " $Log.tlog({id: 'info1055', file_pn: file_pn }) $Log.indent @open_files[file_pn] = File.open(file_pn,'r').read().force_encoding('UTF-8') = File.(file_pn) digest = ["digest_sha256"] mtime = ["mtime"] ctime = ["ctime"] # fsctime = metadata["fsctime"] #dput "file digest (SHA-256): #{digest}" $Log.tlog({id: 'info1056', digest: digest }) #dput "file mtime: #{mtime}" $Log.tlog({id: 'info1057', mtime: mtime }) #dput "file ctime: #{ctime}" $Log.tlog({id: 'info1058', ctime: ctime }) #dpun $Log.undent $Log.tlog({id: 'done_and_newline'}) #dput "done" # dput "file fsctime: #{$st[:emph]}#{fsctime}" end return @open_files[file_pn] end |