Class: Spacewalk::Capabilities

Inherits:
Object
  • Object
show all
Defined in:
lib/spacewalk/capabilities.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Capabilities

Returns a new instance of Capabilities.



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/spacewalk/capabilities.rb', line 4

def initialize client
  # hash of <capability> => <version>
  @caps = {}
  client.http_last_response["x-rhn-server-capability"].split(",").each do |caps|
	caps.split(",").each do |cap|
#	  puts "#{cap}"
	  raise "Invalid cap '#{cap}'" unless cap =~ /(\s+)?(((\w+)|\.)+)\((\d(-\d)?)\)=(\d)/
	  # name = [ version, value ]
	  @caps[$2] = [$5, $7]
#	  puts "#{$2}(#{$5})=#{$7}"
	end
  end
end