Class: VpsbClient::Builders::UnameParser

Inherits:
SystemInfoParser show all
Defined in:
lib/vpsb_client/builders/system_info_parser.rb

Constant Summary collapse

REGEX =

Linux lino 3.12.6-x86_64-linode36 #2 SMP Mon Jan 13 18:54:10 EST 2014 x86_64 x86_64 x86_64 GNU/Linux

Regexp.new(/\w+ \S+ (?<kernel>\d+\.\d+\.\d+)-(?<type>[^\-\s]+)[\-\s]/)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SystemInfoParser

#find_matches, #find_matches!, #lines

Constructor Details

#initializeUnameParser

Returns a new instance of UnameParser.



63
64
65
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 63

def initialize
  super('uname -a')
end

Instance Attribute Details

#kernelObject (readonly)

Returns the value of attribute kernel.



59
60
61
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 59

def kernel
  @kernel
end

#os_typeObject (readonly)

Returns the value of attribute os_type.



59
60
61
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 59

def os_type
  @os_type
end

Instance Method Details

#parseObject



67
68
69
70
71
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 67

def parse
  matches = find_matches!(REGEX)
  @kernel  = matches[:kernel]
  @os_type = matches[:type]
end