Class: Sys::Mount
Instance Attribute Summary collapse
-
#dev ⇒ Object
Returns the value of attribute dev.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #dirname ⇒ Object
-
#initialize(line) ⇒ Mount
constructor
A new instance of Mount.
- #inspect ⇒ Object
- #path ⇒ Object
- #system? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(line) ⇒ Mount
Returns a new instance of Mount.
18 19 20 21 |
# File 'lib/epitools/sys/mounts.rb', line 18 def initialize(line) @path, @dev, @type, @options = line.strip.split(' ') @options = @options.split(",") end |
Instance Attribute Details
#dev ⇒ Object
Returns the value of attribute dev.
16 17 18 |
# File 'lib/epitools/sys/mounts.rb', line 16 def dev @dev end |
#options ⇒ Object
Returns the value of attribute options.
16 17 18 |
# File 'lib/epitools/sys/mounts.rb', line 16 def @options end |
Instance Method Details
#dirname ⇒ Object
40 41 42 |
# File 'lib/epitools/sys/mounts.rb', line 40 def dirname path.dirs.last end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/epitools/sys/mounts.rb', line 27 def inspect "#{type}: #{path} (#{dev})" end |
#path ⇒ Object
35 36 37 38 |
# File 'lib/epitools/sys/mounts.rb', line 35 def path # Unescape findmnt's hex codes Path.new "#{eval %{"#{@path}"}}/" end |
#system? ⇒ Boolean
23 24 25 |
# File 'lib/epitools/sys/mounts.rb', line 23 def system? (path =~ %r{^/(sys|dev|proc|run/user|tmp)}) or dev == "systemd-1" end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/epitools/sys/mounts.rb', line 31 def to_s "#{path} (#{dev})" end |