Class: Inspec::Resources::Mount
  
  
  
  
  
    - Inherits:
- 
      Object
      
        
          - Object
- Inspec::Resources::Mount
 show all
    - Defined in:
- lib/resources/mount.rb
 
  Instance Attribute Summary collapse
  
  
    
      Instance Method Summary
      collapse
    
    
  
  Constructor Details
  
    
  
  
    #initialize(path)  ⇒ Mount 
  
  
  
  
    
Returns a new instance of Mount.
   
 
  
  
    | 
22
23
24
25
26
27 | # File 'lib/resources/mount.rb', line 22
def initialize(path)
  @path = path
  @mount_manager = mount_manager_for_os
  return skip_resource 'The `mount` resource is not supported on your OS yet.' if @mount_manager.nil?
  @file = inspec.backend.file(@path)
end | 
 
  
 
  Dynamic Method Handling
  
    This class handles dynamic methods through the method_missing method
    
  
  
    
  
  
    #method_missing(name)  ⇒ Object 
  
  
  
  
    | 
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | # File 'lib/resources/mount.rb', line 39
def method_missing(name)
  return nil if !file.mounted?
  mounted = file.mounted
  return nil if mounted.nil? || mounted.stdout.nil?
  line = mounted.stdout
    line = mounted.stdout.lines.to_a.last if mounted.stdout.lines.count > 1
    @mount_options ||= @mount_manager.parse_mount_options(line)
  @mount_options[name]
end | 
 
  
 
  
    Instance Attribute Details
    
      
      
      
  
  
    #file  ⇒ Object  
  
  
  
  
    
Returns the value of attribute file.
   
 
  
  
    | 
20
21
22 | # File 'lib/resources/mount.rb', line 20
def file
  @file
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #count  ⇒ Object 
  
  
  
  
    | 
33
34
35
36
37 | # File 'lib/resources/mount.rb', line 33
def count
  mounted = file.mounted
  return nil if mounted.nil? || mounted.stdout.nil?
  mounted.stdout.lines.count
end | 
 
    
      
  
  
    #mounted?  ⇒ Boolean 
  
  
  
  
    | 
29
30
31 | # File 'lib/resources/mount.rb', line 29
def mounted?
  file.mounted?
end | 
 
    
      
  
  
    #to_s  ⇒ Object 
  
  
  
  
    | 
54
55
56 | # File 'lib/resources/mount.rb', line 54
def to_s
  "Mount #{@path}"
end |