class CC::Analyzer::Filesystem
Attributes
root[R]
Public Class Methods
new(root)
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 6 def initialize(root) @root = root end
Public Instance Methods
exist?(path)
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 10 def exist?(path) File.exist?(path_for(path)) end
ls()
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 27 def ls Dir.entries(root).reject { |entry| [".", ".."].include?(entry) } end
read_path(path)
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 18 def read_path(path) File.read(path_for(path)) end
source_buffer_for(path)
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 14 def source_buffer_for(path) SourceBuffer.new(path, read_path(path)) end
write_path(path, content)
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 22 def write_path(path, content) File.write(path_for(path), content) File.chown(root_uid, root_gid, path_for(path)) end
Private Instance Methods
path_for(path)
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 33 def path_for(path) File.join(root, path) end
root_gid()
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 41 def root_gid root_stat.gid end
root_stat()
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 45 def root_stat @root_stat ||= File.stat(root) end
root_uid()
click to toggle source
# File lib/cc/analyzer/filesystem.rb, line 37 def root_uid root_stat.uid end