class VpsbClient::Builders::SystemInfoParser
Public Class Methods
new(cmd)
click to toggle source
# File lib/vpsb_client/builders/system_info_parser.rb, line 6 def initialize(cmd) @cmd = cmd end
Public Instance Methods
find_matches(regex)
click to toggle source
# File lib/vpsb_client/builders/system_info_parser.rb, line 14 def find_matches(regex) regex = Regexp.new(regex) matches = nil lines.each do |line| matches = regex.match(line) break if matches end matches end
find_matches!(regex)
click to toggle source
# File lib/vpsb_client/builders/system_info_parser.rb, line 24 def find_matches!(regex) matches = find_matches(regex) raise NoMatchError, "Cannot find /#{regex}/" unless matches matches end
lines()
click to toggle source
# File lib/vpsb_client/builders/system_info_parser.rb, line 10 def lines IO.popen(@cmd) { |f| f.readlines } end