Class: Lpar_IO_slot

Inherits:
Object
  • Object
show all
Defined in:
lib/HMC/Lpar_IO_slot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Lpar_IO_slot

Returns a new instance of Lpar_IO_slot.



11
12
13
14
15
16
17
18
# File 'lib/HMC/Lpar_IO_slot.rb', line 11

def initialize(string)
  @slot_DRC_index = nil
  @slot_IO_pool_ID = 'none'
  @is_required = 0
  @data_string_raw = nil

  parse(string) unless string.empty?
end

Instance Attribute Details

#data_string_rawObject (readonly)

Returns the value of attribute data_string_raw.



5
6
7
# File 'lib/HMC/Lpar_IO_slot.rb', line 5

def data_string_raw
  @data_string_raw
end

#is_requiredObject

Returns the value of attribute is_required.



9
10
11
# File 'lib/HMC/Lpar_IO_slot.rb', line 9

def is_required
  @is_required
end

#slot_DRC_indexObject

Returns the value of attribute slot_DRC_index.



7
8
9
# File 'lib/HMC/Lpar_IO_slot.rb', line 7

def slot_DRC_index
  @slot_DRC_index
end

#slot_IO_pool_IDObject

Returns the value of attribute slot_IO_pool_ID.



8
9
10
# File 'lib/HMC/Lpar_IO_slot.rb', line 8

def slot_IO_pool_ID
  @slot_IO_pool_ID
end

Instance Method Details

#parse(string) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/HMC/Lpar_IO_slot.rb', line 20

def parse(string)
  @data_string_raw = string

  regexp = %r{^\s*(\w+)\/(none|d+)\/([01])\s*$}

  if match = regexp.match(string)
    @slot_DRC_index = match[1]
    @slot_IO_pool_ID = match[2]
    @is_required = match[3].to_i
  else
    pp string
    pp regexp
    pp match
    raise 'wrong string to parse'
  end
end

#to_sObject



37
38
39
# File 'lib/HMC/Lpar_IO_slot.rb', line 37

def to_s
  "#{@slot_DRC_index}/#{@slot_IO_pool_ID}/#{is_required}"
end