Class: Filesystems
- Defined in:
- lib/panda_motd/components/filesystems.rb
Instance Attribute Summary
Attributes inherited from Component
#config, #errors, #name, #results
Instance Method Summary collapse
-
#initialize(motd) ⇒ Filesystems
constructor
A new instance of Filesystems.
- #process ⇒ Object
- #to_s ⇒ Object
Methods inherited from Component
Constructor Details
#initialize(motd) ⇒ Filesystems
Returns a new instance of Filesystems.
7 8 9 |
# File 'lib/panda_motd/components/filesystems.rb', line 7 def initialize(motd) super(motd, "filesystems") end |
Instance Method Details
#process ⇒ Object
11 12 13 |
# File 'lib/panda_motd/components/filesystems.rb', line 11 def process @results = parse_filesystem_usage(@config["filesystems"]) end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/panda_motd/components/filesystems.rb', line 15 def to_s name_col_size = @results.select { |r| r.is_a? Hash } .map { |r| r[:pretty_name].length } .max || 0 size_w_padding = (name_col_size + 6) > 13 ? (name_col_size + 6) : 13 result = +"Filesystems".ljust(size_w_padding, " ") result << "Size Used Free Use%\n" @results.each do |filesystem| result << format_filesystem(filesystem, size_w_padding) end result end |