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 35
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 23
def atime
  status.atime
end
ctime() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 19
def ctime
  status.ctime
end
executable?() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 15
def executable?
  status.executable?
end
group() click to toggle source

Return owning group

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

Return permissions

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

Return owner

# File lib/aruba/platforms/filesystem_status.rb, line 45
def owner
  status.uid
end
size() click to toggle source
# File lib/aruba/platforms/filesystem_status.rb, line 31
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 58
def to_h
  {
    owner: owner,
    group: group,
    mode: mode,
    executable: executable?,
    ctime: ctime,
    atime: atime,
    mtime: mtime,
    size: size
  }
end