class Aruba::Platforms::FilesystemStatus

File System Status object

This is a wrapper for File::Stat returning only a subset of information.

Attributes

status[R]

Public Class Methods

new(path) click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 33
def initialize(path)
  @status = File::Stat.new(path)
end

Public Instance Methods

atime() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 21
def atime
  status.atime
end
ctime() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 17
def ctime
  status.ctime
end
executable?() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 13
def executable?
  status.executable?
end
group() click to toggle source

Return owning group

# File lib/aruba/platforms/filesystem_status.rb, line 48
def group
  status.gid
end
mode() click to toggle source

Return permissions

# File lib/aruba/platforms/filesystem_status.rb, line 38
def mode
  format("%o", status.mode)[-4, 4].gsub(/^0*/, "")
end
mtime() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 25
def mtime
  status.mtime
end
owner() click to toggle source

Return owner

# File lib/aruba/platforms/filesystem_status.rb, line 43
def owner
  status.uid
end
size() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 29
def size
  status.size
end
to_h() click to toggle source

Convert status to hash

@return [Hash]

A hash of values
# File lib/aruba/platforms/filesystem_status.rb, line 56
def to_h
  {
    owner: owner,
    group: group,
    mode: mode,
    executable: executable?,
    ctime: ctime,
    atime: atime,
    mtime: mtime,
    size: size
  }
end