class DellX
Public Instance Methods
clean(cfg)
click to toggle source
# File lib/redoxed/model/dellx.rb, line 55 def clean(cfg) out = [] skip_blocks = 0 cfg.each_line do |line| # If this is a stackable switch we should skip this block of information if line.match(/Up\sTime|Temperature|Power Suppl(ies|y)|Fans/i) && (@stackable == true) skip_blocks = 1 # Some switches have another empty line. This is identified by this line having a colon skip_blocks = 2 if line =~ /:/ end # If we have lines to skip do this until we reach and empty line if skip_blocks.positive? skip_blocks -= 1 if /\S/ !~ line next end out << line.strip end out = out.reject { |line| line[/Up\sTime/] } out = comment out.join "\n" out << "\n" end