Class: Aruba::Platforms::FilesystemStatus
- Inherits:
 - 
      Object
      
        
- Object
 - Aruba::Platforms::FilesystemStatus
 
 
- Defined in:
 - lib/aruba/platforms/filesystem_status.rb
 
Overview
File System Status object
This is a wrapper for File::Stat returning only a subset of information.
Instance Method Summary collapse
- #atime ⇒ Object
 - #ctime ⇒ Object
 - #executable? ⇒ Boolean
 - 
  
    
      #group  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return owning group.
 - 
  
    
      #initialize(path)  ⇒ FilesystemStatus 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of FilesystemStatus.
 - 
  
    
      #mode  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return permissions.
 - #mtime ⇒ Object
 - 
  
    
      #owner  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return owner.
 - #size ⇒ Object
 - 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Convert status to hash.
 
Constructor Details
#initialize(path) ⇒ FilesystemStatus
Returns a new instance of FilesystemStatus.
      35 36 37  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 35 def initialize(path) @status = File::Stat.new(path) end  | 
  
Instance Method Details
#atime ⇒ Object
      23 24 25  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 23 def atime status.atime end  | 
  
#ctime ⇒ Object
      19 20 21  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 19 def ctime status.ctime end  | 
  
#executable? ⇒ Boolean
      15 16 17  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 15 def executable? status.executable? end  | 
  
#group ⇒ Object
Return owning group
      50 51 52  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 50 def group status.gid end  | 
  
#mode ⇒ Object
Return permissions
      40 41 42  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 40 def mode format('%o', status.mode)[-4, 4].gsub(/^0*/, '') end  | 
  
#mtime ⇒ Object
      27 28 29  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 27 def mtime status.mtime end  | 
  
#owner ⇒ Object
Return owner
      45 46 47  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 45 def owner status.uid end  | 
  
#size ⇒ Object
      31 32 33  | 
    
      # File 'lib/aruba/platforms/filesystem_status.rb', line 31 def size status.size end  | 
  
#to_h ⇒ Hash
Convert status to hash
      58 59 60 61 62 63 64 65 66 67 68 69  | 
    
      # 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  |