Class: Resource
- Inherits:
-
Object
- Object
- Resource
- Defined in:
- lib/HMC/Resource.rb
Instance Attribute Summary collapse
-
#frame ⇒ Object
readonly
Returns the value of attribute frame.
-
#lpar ⇒ Object
readonly
Returns the value of attribute lpar.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_long ⇒ Object
readonly
Returns the value of attribute type_long.
Instance Method Summary collapse
- #decode(string) ⇒ Object
-
#initialize(string = '') ⇒ Resource
constructor
cec:root/ibmhscS1_0|9131-52A*6535CCG|IBMHSC_ComputerSystem, lpar:root/ibmhscS1_0|ALL_PARTITIONS*9131-52A*6535CCG|IBMHSC_Partition lpar:root/ibmhscS1_0|1*9131-52A*6535CCG|IBMHSC_Partition, lpar:root/ibmhscS1_0|5*9131-52A*6535CCG|IBMHSC_Partition.
Constructor Details
#initialize(string = '') ⇒ Resource
cec:root/ibmhscS1_0|9131-52A*6535CCG|IBMHSC_ComputerSystem, lpar:root/ibmhscS1_0|ALL_PARTITIONS*9131-52A*6535CCG|IBMHSC_Partition lpar:root/ibmhscS1_0|1*9131-52A*6535CCG|IBMHSC_Partition, lpar:root/ibmhscS1_0|5*9131-52A*6535CCG|IBMHSC_Partition
14 15 16 |
# File 'lib/HMC/Resource.rb', line 14 def initialize(string = '') decode(string) unless string.empty? end |
Instance Attribute Details
#frame ⇒ Object (readonly)
Returns the value of attribute frame.
7 8 9 |
# File 'lib/HMC/Resource.rb', line 7 def frame @frame end |
#lpar ⇒ Object (readonly)
Returns the value of attribute lpar.
6 7 8 |
# File 'lib/HMC/Resource.rb', line 6 def lpar @lpar end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/HMC/Resource.rb', line 5 def type @type end |
#type_long ⇒ Object (readonly)
Returns the value of attribute type_long.
8 9 10 |
# File 'lib/HMC/Resource.rb', line 8 def type_long @type_long end |
Instance Method Details
#decode(string) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/HMC/Resource.rb', line 18 def decode(string) type_regexp = '\w{4}\-\w{3}\*\w{7}' if match = %r{lpar:root[\/]+ibmhscS1_0\|(\d+|ALL_PARTITIONS)\*(#{type_regexp})}.match(string) @type_long = 'IBMHSC_Partition' @type = 'lpar' @lpar = match[1] @frame = match[2] elsif match = %r{cec:root[\/]+ibmhscS1_0\|(#{type_regexp})\|IBMHSC_ComputerSystem}.match(string) @type_long = 'IBMHSC_ComputerSystem' @type = 'cec' @frame = match[1] elsif match = %r{frame:root[\/]+ibmhscS1_0\|(#{type_regexp})\|IBMHSC_Frame}.match(string) @type_long = 'IBMHSC_Frame' @type = 'frame' @frame = match[1] else raise Exception, "Regexo couldn't decode string >#{string}<" end end |