class Node::NodeFile
Attributes
content[W]
group[W]
mode[W]
user[W]
Public Class Methods
new(path:, filesystem: @path = path)
click to toggle source
# File app/node/file.rb, line 2 def initialize path:, filesystem: @path = path @filesystem = filesystem end
Public Instance Methods
content()
click to toggle source
# File app/node/file.rb, line 9 def content @content ||= begin result = Net::SCP::download!(@filesystem.node.name, nil, @path) rescue Net::SCP::Error result = "" end end
diffable()
click to toggle source
# File app/node/file.rb, line 17 def diffable # TODO? "#{content}" + "\\" + "PERMISSIONS #{user}:#{group} #{mode}" end
group()
click to toggle source
# File app/node/file.rb, line 29 def group @group ||= @filesystem.node.remote.execute( "stat -c '%G' '#{@path}'" ).chomp.chomp end
mode()
click to toggle source
# File app/node/file.rb, line 35 def mode @mode ||= @filesystem.node.remote.execute( "stat -c '%a' * '#{@path}'" ).chomp.chomp.to_i end
user()
click to toggle source
# File app/node/file.rb, line 23 def user @user ||= @filesystem.node.remote.execute( "stat -c '%U' '#{@path}'" ).chomp.chomp end